#include using namespace std; typedef long long ll; typedef pair P; #define F first #define S second int main(){ int n; cin>>n; P p[n][2]; map > m; for(int i=0;i>p[i][0].F>>p[i][0].S>>p[i][1].F>>p[i][1].S; m[p[i][0]].push_back(P(i,0)); m[p[i][1]].push_back(P(i,1)); } bool u[n],f=1; memset(u,0,sizeof(u)); for(int i=0;i q; q.push(i); while(!q.empty()){ int x=q.front();q.pop(); if(v[x]) continue; v[x]=1; for(int k=0;k<(int)m[p[x][w[x]]].size();k++){ P np=m[p[x][w[x]]][k]; if(np.F==x) continue; if(v[np.F]){ if(w[np.F]!=np.S) fff=0; }else{ w[np.F]=!np.S; } q.push(np.F); } } for(int k=0;k