#include #include #include #include #include #include #include using namespace std; typedef pair Coords; struct Groove { int x1, x2, y; }; bool grvCmp(const Groove& a, const Groove& b) { return a.y < b.y; } int main() { ios::sync_with_stdio(false); int numHunt, numGroov; cin >> numHunt >> numGroov; vector grooves; for (int i = 0; i < numGroov; ++i) { int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2; grooves.push_back({x1, x2, y1}); } sort(grooves.begin(), grooves.end(), grvCmp); vector hunters(numHunt); for (int i = 0; i < numHunt; ++i) { // nezapomenout pri vypisu dat +1, v zadani jsou souradnice od 1 hunters[i] = i; } for (auto& groove : grooves) { swap(hunters[groove.x1], hunters[groove.x2]); } vector hunterPoss(numHunt); for (int i = 0; i < numHunt; ++i) { hunterPoss[hunters[i]] = i; } for (auto pos : hunterPoss) { cout << pos+1 << endl; } /* //for (int i = 0; i < yMax.size(); ++i) //cout << "ymax for " << i << " is " << yMax[i] << endl; //cout << "numhunt " << numHunt << endl; for (int i = 1; i <= numHunt; ++i) { int hx = i; int hy = 0; while (hy <= yMax[hx]) { hy++; auto row = grooves.find(hy); if (row == grooves.end()) continue; auto col = row->second.find(hx); if (col != row->second.end()) { hx = col->second; } } cout << hx << endl; } */ return 0; }