#include using namespace std; #define ll long long #define pb push_back #define mp make_pair #define ALL(x) (x).begin(),(x).end() #define rALL(x) (x).rbegin(),(x).rend() #define srt(x) sort(ALL(x)) #define rev(x) reverse(ALL(x)) #define rsrt(x) sort(rALL(x)) #define sz(x) (int)(x.size()) void die(string S){puts(S.c_str());exit(0);} int dp[100100]; void solve() { int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;i++) dp[i]=1e7; dp[k]=0; for(int i=0;i>u>>v; int tmpu=dp[u],tmpv=dp[v]; dp[u]=min(tmpu+1,tmpv); dp[v]=min(tmpu,tmpv+1); } for(int i=1;i<=n;i++) { if(dp[i]!=1e7) cout<>T; while(T--) solve(); return 0; }