#include using namespace std; using ll = long long; using ull = unsigned long long; using vi = vector; using vvi = vector>; using vll = vector; void solve() { int n, m; cin >> n >> m; vector>> sgs(m); for (auto& x : sgs) { cin >> x.second.first >> x.first >> x.second.second >> x.first; --x.second.first; --x.second.second; } sort(sgs.begin(), sgs.end()); vi res(n); iota(res.begin(), res.end(), 0); for (auto x : sgs) { swap(res[x.second.first], res[x.second.second]); } vi inv(n); for (int i = 0; i < n; ++i) inv[res[i]] = i; for (int i = 0; i < n; ++i) { cout << inv[i] + 1 << '\n'; } } int main() { ios_base::sync_with_stdio(false); cin.tie(0); int t = 1; //cin >> t; while (t--) { solve(); } return 0; }