#include using namespace std; const int inf=0x3f3f3f3f; int n,m,x1[505],y1[505],x2[505],y2[505],d[505]; vector G[505]; inline side(int x,int y,int x1,int y1,int x2,int y2) { int X1=x2-x1,Y1=y2-y1; int X2=x1-x,Y2=y1-y; return X1*Y2-X2*Y1<0; } inline bool check(int ii,int jj) { if (x2[ii]==x2[jj]&&y2[ii]==y2[jj]) return false; for (int i=0;i0) return false; return true; } inline bfs(int o) { queue que; que.push(o); memset(d,0x3f,sizeof d); d[o]=0; while (!que.empty()) { int u=que.front(); que.pop(); for (int i=0;i<(int)G[u].size();++i) { int v=G[u][i]; if (v==o) return d[u]+1; if (d[v]!=inf) continue; d[v]=d[u]+1; que.push(v); } } return inf; } int main() { while (scanf("%d",&n)==1) { for (int i=0;i