#include using namespace std; template ostream& operator<<(ostream& out, const vector &cont) { out << "["; for(const auto &x: cont) out << x<< ", "; out << "]"; return out; } #define dmp(x) cerr << #x << " = " << x << endl #define dmpn(x) cerr << #x << " = " << x <<"; " #define ff first #define ss second #define all(x) begin(x), end(x) #define sz(x) (int) (x).size() #define int long long typedef long long ll; typedef pair pii; typedef long double ld; void solve() { int n, m; cin >> n >> m; vector a(n); for(int i=0; i>> mapp; while(m--){ int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2; y1--; y2--; x1--; x2--; mapp[y1].push_back({x1, x2}); } for(auto i:mapp){ for(auto j:i.second){ swap(a[j.first], a[j.second]); } } vector ans(n); for(int i=0; isync_with_stdio(0); cin.exceptions(cin.failbit); solve(); return 0; }