func_code_string: #include <bits/stdc++.h>   using namespace std;   bool SR(int &x) { return scanf( %d , &x) == 1; }   bool SR(long long &x) { return scanf( %lld , &x) == 1; }   bool SR(double &x) { return scanf( %lf , &x) == 1; }   bool SR(char *s) { return scanf( %s , s) == 1; }   bool RI() { return true; }   template <typename I, typename... T>   bool RI(I &x, T &...tail) {     return SR(x) && RI(tail...);   }   void SP(const int x) { printf( %d , x); }   void SP(const long long x) { printf( %lld , x); }   void SP(const double x) { printf( %.16lf , x); }   void SP(const char *s) { printf( %s , s); }   void PL() { puts(  ); }   template <typename I, typename... T>   void PL(const I x, const T... tail) {     SP(x);     if (sizeof...(tail)) putchar(   );     PL(tail...);   }   const int maxn = 3e5 + 5;   int n, m, k;   vector<int> edge[maxn];   vector<int> vol;   int src, tar;   void read() {     RI(n, m, k);     vol.resize(k);     for (int i = 0; i < int(k); i++) RI(vol[i]);     for (int i = (1); i <= int(m); i++) {       int a, b;       RI(a, b);       edge[a].push_back(n + i);       edge[n + i].push_back(a);       edge[b].push_back(n + i);       edge[n + i].push_back(b);     }     RI(src, tar);   }   struct Dsu {     int par[maxn];     void init() {       for (int i = (1); i <= int(n); i++) par[i] = i;     }     int find(int x) { return x == par[x] ? x : par[x] = find(par[x]); }     void merge(int a, int b) { par[find(a)] = find(b); }   } dsu;   void build() {     n += m;     dsu.init();     if (find((vol).begin(), (vol).end(), tar) == vol.end())       vol.push_back(tar), k++;   }   bitset<maxn> vis;   void sol() {     vector<int> prv, cur;     cur = vol;     for (int ans = (1); ans <= int(maxn); ans++) {       prv.swap(cur);       cur.clear();       for (auto u : prv)         if (!vis[u]) {           vis[u] = 1;           for (auto v : edge[u]) dsu.merge(u, v);           cur.insert(cur.end(), (edge[u]).begin(), (edge[u]).end());         }       if (dsu.find(src) == dsu.find(tar)) {         PL(ans);         return;       }     }     PL(-1);   }   int main() {     read();     build();     sol();     return 0;   }   