#include #include #include using namespace std; template inline void read(T& t) { t=0; bool f=false; char ch; while(ch=getchar(),!((ch>='0'&&ch<='9')||ch=='-')); if(ch=='-') f=true,ch=getchar(); t=ch-'0'; while(ch=getchar(),ch>='0'&&ch<='9') t=t*10+ch-'0'; if(f) t=-t; } template inline void read(T& t,Args&... args) { read(t); read(args...); } const int maxn=1e6+7; int n,m,x,xval,y,yval; vector G[maxn*2]; int id[maxn][70]; int dfn[maxn*2],lowlink[maxn*2],sccno[maxn*2],dfs_cnt,scc_cnt; stack stk; void dfs(int u) { dfn[u]=lowlink[u]=++dfs_cnt; stk.push(u); for(int i=0;i0) { read(x,xval,y,yval); x--; y--; x=x*2+xval; y=y*2+yval; G[x^1].push_back(y); G[y^1].push_back(x); } for(int i=0;i<2*n;i++) if(!dfn[i]) dfs(i); for(int i=0;i<2*n;i+=2) if(sccno[i]==sccno[i+1]) { puts("IMPOSSIBLE"); return 0; } puts("POSSIBLE"); for(int i=0;isccno[i*2+1]); puts(""); return 0; }