#define _USE_MATH_DEFINES #pragma GCC target("avx2") #pragma GCC optimize("O3") #include #include #include #include #include #include //#include using namespace std; //using namespace atcoder; #define LP(I,S,G) for (long long int I = (S); I < (G); ++I) #define IN(X) for (int in = 0; in < X.size(); in++)cin >> X[in] #define OUT(X) for (int in = 0; in < X.size(); in++)cout << X[in]<<" " #define SORT(X) sort((X).begin(), (X).end()) #define CSORT(X,Y) sort(X.begin(), X.end(),Y) #define COPY(X,Y) copy(X.begin(), X.end(), Y.begin()) #define ALL(X,Y) for (auto &(X) :(Y)) #define FULL(a) (a).begin(),(a).end() #define BFS(Q,S) for(Q.push(S);Q.size()!=0;Q.pop()) typedef long long int ll; typedef unsigned long long int ull; long long int M = 998244353; chrono::system_clock::time_point starttime; using namespace std::chrono; inline float getTime() { return duration_cast(system_clock::now() - starttime).count(); } int dx[] = { -1,0,1,0 }, dy[] = { 0,1,0,-1 }; ll MAX(ll A, ll B) { return ((A) > (B) ? (A) : (B)); } ll MIN(ll A, ll B) { return ((A) < (B) ? (A) : (B)); } inline long long int xor128() { static long long int x = 123456789, y = 362436069, z = 521288629, w = 88675123; long long int t = (x ^ (x << 11)); x = y; y = z; z = w; return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8))); } ll f(ll n, map& dp) { if (dp.find(n) != dp.end())return dp[n]; dp[n] = f(n / 2, dp) + f(n / 3, dp); return dp[n]; } /* An undirected, simple connected graph G has n vertices and m edges. The vertices are numbered from 1 to n, and the i-th edge joins the u-th and v-th vertices. Find a subset of edges which form a maximal matching of G. */ int main() { ll n, m; cin >> n >> m; vector> g(n); set s, t, o; vector ans; for (int i = 0; i < n; ++i)o.insert(i); LP(i, 0, m) { ll u, v; cin >> u >> v; --u, --v; if (o.find(u) != o.end() && o.find(v) != o.end()) { o.erase(u); o.erase(v); s.insert(u); t.insert(v); ans.push_back(i + 1); } } cout << ans.size() << "\n"; LP(i, 0, ans.size())cout << ans[i] << "\n"; return 0; }