#pragma GCC optimize("trapv")
#pragma GCC optimize("Ofast")
#pragma GCC optimization ("unroll-loops")
#pragma GCC target ("avx2")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include "bits/stdc++.h"
using namespace std;
#define double long double
#define mp make_pair 
#define fi first
#define se second
#define pb push_back
#define all(a) a.begin(),a.end()
const int MOD = 1000000007;
const int MOD2 = 998244353;
mt19937 rng((int) std::chrono::steady_clock::now().time_since_epoch().count());
const int MAXN = 1e5 + 10;
int n,m, yay;
set<int>adj[3001];
vector<pair<int,int> >edges;
vector<int> path;
map<pair<int,int>,int> oh;
bool eulerian(int centre){
    int cnt=0;
    for(int i=1;i<=n;i++){
        if(adj[i].size()%2==1) cnt++;
    }
    if(cnt==1 || cnt>2){
        return 0;
    }
    vector<int> ok;
    if(cnt==2){
        for(int i=1;i<=n;i++) if(adj[i].size()%2==1) ok.pb(i);
        bool skip = 0;
        for(int x:adj[ok[0]]){
            if(x==ok[1]) {
                skip=1;
                break;
            }
        }
        if(!skip){
            adj[ok[0]].insert(ok[1]);
            adj[ok[1]].insert(ok[0]);
        }
    }
    stack<int> st;
    int first = 0;
    for(int i=1;i<=n;i++){
        if(adj[i].size()){
            first = i;
            break;
        }
    }
    if(first==0){
        return 1;
    }
    st.push(first);
    vector<int> res;
    int tot = 0;
    queue<int> q[n+1];
    map<pair<int,int>,int>mp;
    for(int i=1;i<=n;i++){
        for(int x:adj[i]){
            q[i].push(x);
            mp[{i,x}]=1;
            tot++;
        }
    }
    while(st.size()){
        int t=st.top();
        bool yes = 0;
        while(q[t].size() && mp[{t,q[t].front()}]==0){
            q[t].pop();
        }
        if(q[t].size()){
            yes = 1;
            mp[{t,q[t].front()}] = mp[{q[t].front(),t}] = 0;
            tot-=2;
            st.push(q[t].front());
            q[t].pop();
        }
        if(!yes){
            res.pb(t);
            st.pop();
        }
    }
    if(tot){
        return 0;
    }
    if(res.size()>1 && res[0]==res[res.size()-1]){
        res.erase(res.begin()+res.size()-1);
    }
    if(cnt==2){
        map<pair<int,int>,int>yes;
        vector<int> res3=res;
        for(int i=0;i<(int)res.size();i++){
            if((res[i]==ok[0]&&res[(i+1)%res.size()]==ok[1])||(res[i]==ok[1]&&res[(i+1)%res.size()]==ok[0])){
                vector<int>res2;
                for(int j=i+1;j<=i+res.size();j++){
                    res2.pb(res[j%res.size()]);
                }
                res=res2;
                break;
            }
        }
        for(int i=0;i+1<res.size();i++){
            yes[{res[i], res[i+1]}] = yes[{res[i+1], res[i]}] = 1;
        }
        if(yes[{ok[0], centre}]==1){
            yes.clear();
            swap(ok[0], ok[1]);
            res=res3;
            for(int i=0;i<(int)res.size();i++){
                if((res[i]==ok[0]&&res[(i+1)%res.size()]==ok[1])||(res[i]==ok[1]&&res[(i+1)%res.size()]==ok[0])){
                    vector<int>res2;
                    for(int j=i+1;j<=i+res.size();j++){
                        res2.pb(res[j%res.size()]);
                    }
                    res=res2;
                    break;
                }
            }
            for(int i=0;i+1<res.size();i++){
                yes[{res[i], res[i+1]}] = yes[{res[i+1], res[i]}] = 1;
            }
            if(yes[{ok[0], centre}]==1){
                return 0;
            }
        }
        adj[ok[0]].erase(ok[1]);
        adj[ok[1]].erase(ok[0]);
    }
    else{
        unordered_map<int,int>pos;
        for(int i=0;i<res.size();i++){
            pos[res[i]]=i+1;
        }
        for(int i=0;i<edges.size();i++){
            int wow = pos[edges[i].fi]-1;
            int wow2 = pos[edges[i].se]-1;
            int diff = min(abs(wow-wow2), min(wow,wow2) + (int)res.size() - max(wow,wow2));
            if(pos[edges[i].fi]==0 || pos[edges[i].se]==0) diff = 1e9;
            if(edges[i].fi==centre && pos[edges[i].se]>0 && diff!=1){
                vector<int>res2;
                for(int j=pos[edges[i].se]-1;j<pos[edges[i].se]+res.size()-1;j++){
                    res2.pb(res[j%res.size()]);
                }
                res=res2;
                break;
            }
            else if(edges[i].se==centre && pos[edges[i].fi]>0 && diff!=1){
                vector<int>res2;
                for(int j=pos[edges[i].fi]-1;j<pos[edges[i].fi]+res.size()-1;j++){
                    res2.pb(res[j%res.size()]);
                }
                res=res2;
                break;
            }
        }
        bool lk =0;
        for(int i=0;i<res.size();i++){
            if(res[i]==centre){
                lk=1;
                vector<int>res2;
                for(int j=i;j<i+res.size();j++) res2.pb(res[j%res.size()]);
                res=res2;
                break;
            }
        }
        if(!lk){
            res.pb(res[0]);
        }
    }
    path = res;
    return 1;
}
void answer(bool x,int centre){
    if(!x) reverse(all(path));
    queue<int> q;
    for(int i=0;i<path.size();i++) q.push(path[i]);
    int cnt =0;
    for(int i=0;i<edges.size();i++){
        if(edges[i].fi==centre || edges[i].se==centre) cnt++;
    }
    bool yes=0;
    for(int i=0;i<(int)path.size()-1;i++){
        if(path[i]==centre && path[i+1]==path[path.size()-1]){
            yes=1;
        }
        else if(path[i+1]==centre && path[i]==path[path.size()-1]){
            yes=1;
        }
    }
    map<pair<int,int>,int>mp;
    for(int i=0;i<(int)path.size()-1;i++){
        mp[{path[i],path[i+1]}]=1;
        mp[{path[i+1],path[i]}]=1;
    }
    if(!yes && (path.empty() || centre!=path[path.size()-1])){
        q.push(centre);
        q.push(-1);
        if(path.size()){
            mp[{centre,path[path.size()-1]}]=1;
            mp[{path[path.size()-1],centre}]=1;
        }
    }
    for(int i=0;i<edges.size();i++){
        if(edges[i].fi==centre && mp[{centre,edges[i].se}]==0){
            q.push(edges[i].se);
            q.push(centre);
        }
        else if(edges[i].se==centre && mp[{centre,edges[i].fi}]==0){
            q.push(edges[i].fi);
            q.push(centre);
        }
    }
    vector<int> fin, fin2;
    while(q.size()){
        fin.pb(q.front());
        if(q.front()!=-1) fin2.pb(q.front());
        q.pop();
    }
    for(int i=0;i+1<fin2.size();i++){
        if(oh[{fin2[i], fin2[i+1]}]==0){
            cout << "0\n";
            return;
        }
    }
    int delcnt=0;
    bool del = 1;
    bool active = 0;
    for(int i=0;i<fin.size();i++){
        if(fin[i]==-1) del = 0, active = 1;
        else{
            if(del && i) delcnt++;
            if(active) del=1-del;
        }
    }
    if(delcnt!=m){
        cout << "0\n";
        return;
    }
    cout << fin.size() << "\n";
    for(int x:fin)cout<<x<<" ";
    cout << "\n";
}
void solve(int test_case){
    cin >> n >> m;
    for(int i=0;i<m;i++){
        int x,y;
        cin >> x >> y;
        edges.push_back({x,y});
    }
    yay = edges[0].fi;
    for(int i=0;i<edges.size();i++) oh[{edges[i].fi, edges[i].se}] = oh[{edges[i].se, edges[i].fi}] = 1;
    //exhaust centre of star
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++) adj[j].clear();
        vector<int> y;
        for(int j=0;j<edges.size();j++){
            if(edges[j].fi!=i && edges[j].se!=i){
                adj[edges[j].fi].insert(edges[j].se);
                adj[edges[j].se].insert(edges[j].fi);
            }
            if(edges[j].fi==i) y.pb(edges[j].se);
            if(edges[j].se==i) y.pb(edges[j].fi);
        }
        vector<int> z;
        for(int j=0;j<y.size();j++){
            if(adj[y[j]].size()%2==1){
                adj[i].insert(y[j]);
                adj[y[j]].insert(i);
                z.pb(1);
            }
            else z.pb(0);
        }
        path.clear();
        /*
        cout << "Centre: "<<i<<"\n";
        for(int j=1;j<=n;j++){
            for(int x:adj[j]) if(j<x) cout << j << " " << x << "\n";
        }
        */
        if(eulerian(i)){
            int p = path.size();
            if(p==0){
                answer(0,i);
                return;
            }
            if(path[path.size()-1]==i){
                path.erase(path.begin() + path.size() - 1);
                answer(1,i);
                return;
            }
            if(path[0]==i){
                path.erase(path.begin());
                answer(0,i);
                return;
            }
            for(int j=0;j<edges.size();j++){
                if(p>0 && edges[j].fi==i && edges[j].se==path[0]){
                    answer(0,i);
                    return;
                }
                else if(p>0 && edges[j].fi==i && edges[j].se==path[p-1]){
                    answer(1,i);
                    return;
                }
                else if(p>0 && edges[j].se==i && edges[j].fi==path[0]){
                    answer(0,i);
                    return;
                }
                else if(p>0 && edges[j].se==i && edges[j].fi==path[p-1]){
                    answer(1,i);
                    return;
                }
            }
        }
        for(int j=0;j<y.size();j++){
            if(z[j]){
                adj[i].erase(y[j]);
                adj[y[j]].erase(i);
                if(eulerian(i)){
                    int p = path.size();
                    if(p==0){
                        answer(0,i);
                        return;
                    }
                    if(path[path.size()-1]==i){
                        path.erase(path.begin() + path.size() - 1);
                        answer(1,i);
                        return;
                    }
                    if(path[0]==i){
                        path.erase(path.begin());
                        answer(0,i);
                        return;
                    }
                    for(int k=0;k<edges.size();k++){
                        if(p>0 && edges[j].fi==i && edges[j].se==path[0]){
                            answer(0,i);
                            return;
                        }
                        else if(p>0 && edges[j].fi==i && edges[j].se==path[p-1]){
                            answer(1,i);
                            return;
                        }
                        else if(p>0 && edges[j].se==i && edges[j].fi==path[0]){
                            answer(0,i);
                            return;
                        }
                        else if(p>0 && edges[j].se==i && edges[j].fi==path[p-1]){
                            answer(1,i);
                            return;
                        }
                    }
                }
                adj[i].insert(y[j]);
                adj[y[j]].insert(i);
            }
            else{
                adj[i].insert(y[j]);
                adj[y[j]].insert(i);
                if(eulerian(i)){
                    int p = path.size();
                    if(p==0){
                        answer(0,i);
                        return;
                    }
                    if(path[path.size()-1]==i){
                        path.erase(path.begin() + path.size() - 1);
                        answer(1,i);
                        return;
                    }
                    if(path[0]==i){
                        path.erase(path.begin());
                        answer(0,i);
                        return;
                    }
                    for(int k=0;k<edges.size();k++){
                        if(p>0 && edges[j].fi==i && edges[j].se==path[0]){
                            answer(0,i);
                            return;
                        }
                        else if(p>0 && edges[j].fi==i && edges[j].se==path[p-1]){
                            answer(1,i);
                            return;
                        }
                        else if(p>0 && edges[j].se==i && edges[j].fi==path[0]){
                            answer(0,i);
                            return;
                        }
                        else if(p>0 && edges[j].se==i && edges[j].fi==path[p-1]){
                            answer(1,i);
                            return;
                        }
                    }
                }
                adj[i].erase(y[j]);
                adj[y[j]].erase(i);
            }
        } 
    }
    cout << "0\n";
}
int32_t main(){
    time_t t=clock();
    srand(time(NULL));
    ios::sync_with_stdio(0);
    cin.tie(0);
    int T=1;//cin >> T;
    int test_case=1;
    while(T--){
        solve(test_case);
        test_case++;
    }
    cerr<<"Program terminated successfully\n";
    t=clock()-t;
    cerr<<"Time used: "<<fixed<<setprecision(3)<<(double)(t*1.0/CLOCKS_PER_SEC)<<" seconds\n";
}
/*
8 10
1 2
1 3
2 4
2 5
1 4
1 5
3 7
3 8
7 8
1 6
*/
### Prompt

Your task is to create a Cpp solution to the following problem:

You are given an undirected connected graph consisting of n vertices and m edges. Your goal is to destroy all edges of the given graph.

You may choose any vertex as the starting one and begin walking from it along the edges. When you walk along an edge, you destroy it. Obviously, you cannot walk along an edge if it is destroyed.

You can perform the mode shift operation at most once during your walk, and this operation can only be performed when you are at some vertex (you cannot perform it while traversing an edge). After the mode shift, the edges you go through are deleted in the following way: the first edge after the mode shift is not destroyed, the second one is destroyed, the third one is not destroyed, the fourth one is destroyed, and so on. You cannot switch back to the original mode, and you don't have to perform this operation if you don't want to.

Can you destroy all the edges of the given graph?

Input

The first line contains two integers n and m (2 ≤ n ≤ 3000; n - 1 ≤ m ≤ min((n(n-1))/(2), 3000)) — the numbef of vertices and the number of edges in the graph.

Then m lines follow, each containing two integers x_i and y_i (1 ≤ x_i, y_i ≤ n; x_i ≠ y_i) — the endpoints of the i-th edge. 

These edges form a connected undirected graph without multiple edges.

Output

If it's impossible to destroy all of the edges, print 0.

Otherwise, print the sequence of your actions as follows. First, print k — the number of actions (k ≤ 2m + 2). Then, print the sequence itself, consisting of k integers. The first integer should be the index of the starting vertex. Then, each of the next integers should be either the index of the next vertex in your traversal, or -1 if you use mode shift. You are allowed to use mode shift at most once.

If there are multiple answers, print any of them.

Examples

Input


3 3
1 2
2 3
3 1


Output


4
1 2 3 1


Input


4 3
1 2
2 3
4 2


Output


8
2 -1 1 2 3 2 4 2 


Input


5 5
1 2
2 3
3 1
2 4
2 5


Output


9
2 3 1 2 -1 4 2 5 2 


Input


5 5
1 2
2 3
3 1
2 4
4 5


Output


8
5 4 2 3 1 -1 2 1 


Input


6 5
1 2
2 3
3 4
4 5
3 6


Output


0

### Response

```cpp
#pragma GCC optimize("trapv")
#pragma GCC optimize("Ofast")
#pragma GCC optimization ("unroll-loops")
#pragma GCC target ("avx2")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include "bits/stdc++.h"
using namespace std;
#define double long double
#define mp make_pair 
#define fi first
#define se second
#define pb push_back
#define all(a) a.begin(),a.end()
const int MOD = 1000000007;
const int MOD2 = 998244353;
mt19937 rng((int) std::chrono::steady_clock::now().time_since_epoch().count());
const int MAXN = 1e5 + 10;
int n,m, yay;
set<int>adj[3001];
vector<pair<int,int> >edges;
vector<int> path;
map<pair<int,int>,int> oh;
bool eulerian(int centre){
    int cnt=0;
    for(int i=1;i<=n;i++){
        if(adj[i].size()%2==1) cnt++;
    }
    if(cnt==1 || cnt>2){
        return 0;
    }
    vector<int> ok;
    if(cnt==2){
        for(int i=1;i<=n;i++) if(adj[i].size()%2==1) ok.pb(i);
        bool skip = 0;
        for(int x:adj[ok[0]]){
            if(x==ok[1]) {
                skip=1;
                break;
            }
        }
        if(!skip){
            adj[ok[0]].insert(ok[1]);
            adj[ok[1]].insert(ok[0]);
        }
    }
    stack<int> st;
    int first = 0;
    for(int i=1;i<=n;i++){
        if(adj[i].size()){
            first = i;
            break;
        }
    }
    if(first==0){
        return 1;
    }
    st.push(first);
    vector<int> res;
    int tot = 0;
    queue<int> q[n+1];
    map<pair<int,int>,int>mp;
    for(int i=1;i<=n;i++){
        for(int x:adj[i]){
            q[i].push(x);
            mp[{i,x}]=1;
            tot++;
        }
    }
    while(st.size()){
        int t=st.top();
        bool yes = 0;
        while(q[t].size() && mp[{t,q[t].front()}]==0){
            q[t].pop();
        }
        if(q[t].size()){
            yes = 1;
            mp[{t,q[t].front()}] = mp[{q[t].front(),t}] = 0;
            tot-=2;
            st.push(q[t].front());
            q[t].pop();
        }
        if(!yes){
            res.pb(t);
            st.pop();
        }
    }
    if(tot){
        return 0;
    }
    if(res.size()>1 && res[0]==res[res.size()-1]){
        res.erase(res.begin()+res.size()-1);
    }
    if(cnt==2){
        map<pair<int,int>,int>yes;
        vector<int> res3=res;
        for(int i=0;i<(int)res.size();i++){
            if((res[i]==ok[0]&&res[(i+1)%res.size()]==ok[1])||(res[i]==ok[1]&&res[(i+1)%res.size()]==ok[0])){
                vector<int>res2;
                for(int j=i+1;j<=i+res.size();j++){
                    res2.pb(res[j%res.size()]);
                }
                res=res2;
                break;
            }
        }
        for(int i=0;i+1<res.size();i++){
            yes[{res[i], res[i+1]}] = yes[{res[i+1], res[i]}] = 1;
        }
        if(yes[{ok[0], centre}]==1){
            yes.clear();
            swap(ok[0], ok[1]);
            res=res3;
            for(int i=0;i<(int)res.size();i++){
                if((res[i]==ok[0]&&res[(i+1)%res.size()]==ok[1])||(res[i]==ok[1]&&res[(i+1)%res.size()]==ok[0])){
                    vector<int>res2;
                    for(int j=i+1;j<=i+res.size();j++){
                        res2.pb(res[j%res.size()]);
                    }
                    res=res2;
                    break;
                }
            }
            for(int i=0;i+1<res.size();i++){
                yes[{res[i], res[i+1]}] = yes[{res[i+1], res[i]}] = 1;
            }
            if(yes[{ok[0], centre}]==1){
                return 0;
            }
        }
        adj[ok[0]].erase(ok[1]);
        adj[ok[1]].erase(ok[0]);
    }
    else{
        unordered_map<int,int>pos;
        for(int i=0;i<res.size();i++){
            pos[res[i]]=i+1;
        }
        for(int i=0;i<edges.size();i++){
            int wow = pos[edges[i].fi]-1;
            int wow2 = pos[edges[i].se]-1;
            int diff = min(abs(wow-wow2), min(wow,wow2) + (int)res.size() - max(wow,wow2));
            if(pos[edges[i].fi]==0 || pos[edges[i].se]==0) diff = 1e9;
            if(edges[i].fi==centre && pos[edges[i].se]>0 && diff!=1){
                vector<int>res2;
                for(int j=pos[edges[i].se]-1;j<pos[edges[i].se]+res.size()-1;j++){
                    res2.pb(res[j%res.size()]);
                }
                res=res2;
                break;
            }
            else if(edges[i].se==centre && pos[edges[i].fi]>0 && diff!=1){
                vector<int>res2;
                for(int j=pos[edges[i].fi]-1;j<pos[edges[i].fi]+res.size()-1;j++){
                    res2.pb(res[j%res.size()]);
                }
                res=res2;
                break;
            }
        }
        bool lk =0;
        for(int i=0;i<res.size();i++){
            if(res[i]==centre){
                lk=1;
                vector<int>res2;
                for(int j=i;j<i+res.size();j++) res2.pb(res[j%res.size()]);
                res=res2;
                break;
            }
        }
        if(!lk){
            res.pb(res[0]);
        }
    }
    path = res;
    return 1;
}
void answer(bool x,int centre){
    if(!x) reverse(all(path));
    queue<int> q;
    for(int i=0;i<path.size();i++) q.push(path[i]);
    int cnt =0;
    for(int i=0;i<edges.size();i++){
        if(edges[i].fi==centre || edges[i].se==centre) cnt++;
    }
    bool yes=0;
    for(int i=0;i<(int)path.size()-1;i++){
        if(path[i]==centre && path[i+1]==path[path.size()-1]){
            yes=1;
        }
        else if(path[i+1]==centre && path[i]==path[path.size()-1]){
            yes=1;
        }
    }
    map<pair<int,int>,int>mp;
    for(int i=0;i<(int)path.size()-1;i++){
        mp[{path[i],path[i+1]}]=1;
        mp[{path[i+1],path[i]}]=1;
    }
    if(!yes && (path.empty() || centre!=path[path.size()-1])){
        q.push(centre);
        q.push(-1);
        if(path.size()){
            mp[{centre,path[path.size()-1]}]=1;
            mp[{path[path.size()-1],centre}]=1;
        }
    }
    for(int i=0;i<edges.size();i++){
        if(edges[i].fi==centre && mp[{centre,edges[i].se}]==0){
            q.push(edges[i].se);
            q.push(centre);
        }
        else if(edges[i].se==centre && mp[{centre,edges[i].fi}]==0){
            q.push(edges[i].fi);
            q.push(centre);
        }
    }
    vector<int> fin, fin2;
    while(q.size()){
        fin.pb(q.front());
        if(q.front()!=-1) fin2.pb(q.front());
        q.pop();
    }
    for(int i=0;i+1<fin2.size();i++){
        if(oh[{fin2[i], fin2[i+1]}]==0){
            cout << "0\n";
            return;
        }
    }
    int delcnt=0;
    bool del = 1;
    bool active = 0;
    for(int i=0;i<fin.size();i++){
        if(fin[i]==-1) del = 0, active = 1;
        else{
            if(del && i) delcnt++;
            if(active) del=1-del;
        }
    }
    if(delcnt!=m){
        cout << "0\n";
        return;
    }
    cout << fin.size() << "\n";
    for(int x:fin)cout<<x<<" ";
    cout << "\n";
}
void solve(int test_case){
    cin >> n >> m;
    for(int i=0;i<m;i++){
        int x,y;
        cin >> x >> y;
        edges.push_back({x,y});
    }
    yay = edges[0].fi;
    for(int i=0;i<edges.size();i++) oh[{edges[i].fi, edges[i].se}] = oh[{edges[i].se, edges[i].fi}] = 1;
    //exhaust centre of star
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++) adj[j].clear();
        vector<int> y;
        for(int j=0;j<edges.size();j++){
            if(edges[j].fi!=i && edges[j].se!=i){
                adj[edges[j].fi].insert(edges[j].se);
                adj[edges[j].se].insert(edges[j].fi);
            }
            if(edges[j].fi==i) y.pb(edges[j].se);
            if(edges[j].se==i) y.pb(edges[j].fi);
        }
        vector<int> z;
        for(int j=0;j<y.size();j++){
            if(adj[y[j]].size()%2==1){
                adj[i].insert(y[j]);
                adj[y[j]].insert(i);
                z.pb(1);
            }
            else z.pb(0);
        }
        path.clear();
        /*
        cout << "Centre: "<<i<<"\n";
        for(int j=1;j<=n;j++){
            for(int x:adj[j]) if(j<x) cout << j << " " << x << "\n";
        }
        */
        if(eulerian(i)){
            int p = path.size();
            if(p==0){
                answer(0,i);
                return;
            }
            if(path[path.size()-1]==i){
                path.erase(path.begin() + path.size() - 1);
                answer(1,i);
                return;
            }
            if(path[0]==i){
                path.erase(path.begin());
                answer(0,i);
                return;
            }
            for(int j=0;j<edges.size();j++){
                if(p>0 && edges[j].fi==i && edges[j].se==path[0]){
                    answer(0,i);
                    return;
                }
                else if(p>0 && edges[j].fi==i && edges[j].se==path[p-1]){
                    answer(1,i);
                    return;
                }
                else if(p>0 && edges[j].se==i && edges[j].fi==path[0]){
                    answer(0,i);
                    return;
                }
                else if(p>0 && edges[j].se==i && edges[j].fi==path[p-1]){
                    answer(1,i);
                    return;
                }
            }
        }
        for(int j=0;j<y.size();j++){
            if(z[j]){
                adj[i].erase(y[j]);
                adj[y[j]].erase(i);
                if(eulerian(i)){
                    int p = path.size();
                    if(p==0){
                        answer(0,i);
                        return;
                    }
                    if(path[path.size()-1]==i){
                        path.erase(path.begin() + path.size() - 1);
                        answer(1,i);
                        return;
                    }
                    if(path[0]==i){
                        path.erase(path.begin());
                        answer(0,i);
                        return;
                    }
                    for(int k=0;k<edges.size();k++){
                        if(p>0 && edges[j].fi==i && edges[j].se==path[0]){
                            answer(0,i);
                            return;
                        }
                        else if(p>0 && edges[j].fi==i && edges[j].se==path[p-1]){
                            answer(1,i);
                            return;
                        }
                        else if(p>0 && edges[j].se==i && edges[j].fi==path[0]){
                            answer(0,i);
                            return;
                        }
                        else if(p>0 && edges[j].se==i && edges[j].fi==path[p-1]){
                            answer(1,i);
                            return;
                        }
                    }
                }
                adj[i].insert(y[j]);
                adj[y[j]].insert(i);
            }
            else{
                adj[i].insert(y[j]);
                adj[y[j]].insert(i);
                if(eulerian(i)){
                    int p = path.size();
                    if(p==0){
                        answer(0,i);
                        return;
                    }
                    if(path[path.size()-1]==i){
                        path.erase(path.begin() + path.size() - 1);
                        answer(1,i);
                        return;
                    }
                    if(path[0]==i){
                        path.erase(path.begin());
                        answer(0,i);
                        return;
                    }
                    for(int k=0;k<edges.size();k++){
                        if(p>0 && edges[j].fi==i && edges[j].se==path[0]){
                            answer(0,i);
                            return;
                        }
                        else if(p>0 && edges[j].fi==i && edges[j].se==path[p-1]){
                            answer(1,i);
                            return;
                        }
                        else if(p>0 && edges[j].se==i && edges[j].fi==path[0]){
                            answer(0,i);
                            return;
                        }
                        else if(p>0 && edges[j].se==i && edges[j].fi==path[p-1]){
                            answer(1,i);
                            return;
                        }
                    }
                }
                adj[i].erase(y[j]);
                adj[y[j]].erase(i);
            }
        } 
    }
    cout << "0\n";
}
int32_t main(){
    time_t t=clock();
    srand(time(NULL));
    ios::sync_with_stdio(0);
    cin.tie(0);
    int T=1;//cin >> T;
    int test_case=1;
    while(T--){
        solve(test_case);
        test_case++;
    }
    cerr<<"Program terminated successfully\n";
    t=clock()-t;
    cerr<<"Time used: "<<fixed<<setprecision(3)<<(double)(t*1.0/CLOCKS_PER_SEC)<<" seconds\n";
}
/*
8 10
1 2
1 3
2 4
2 5
1 4
1 5
3 7
3 8
7 8
1 6
*/
```