intmain(){ int n, m; cin >> n >> m; vector<int> s; vector<int> l;
for (int i = 0; i < m; i++) { int u, v; cin >> u >> v; if (u < v) s.push_back(i + 1); else l.push_back(i + 1); } auto ans = s.size() < l.size() ? s : l; cout << ans.size() << "\n"; for (auto c : ans) cout << c << "\n"; return0; }