func_code_string: #include <bits/stdc++.h>   using namespace std;   long long n, m, p, prt[100005], num[100005], ans = 1, cnt, u, v;   inline int getfather(int u) {     if (u == prt[u]) return prt[u];     prt[u] = getfather(prt[u]);     return prt[u];   }   int main() {     scanf( %lld%lld%lld , &n, &m, &p);     for (register int i = 1; i <= n; i++) prt[i] = i;     for (register int i = 1; i <= m; i++) {       scanf( %lld%lld , &u, &v);       register int f1 = getfather(u), f2 = getfather(v);       if (f1 != f2) prt[f1] = f2;     }     for (register int i = 1; i <= n; i++) num[getfather(i)]++;     for (register int i = 1; i <= n; i++)       if (num[i]) cnt++, ans = ans * num[i] % p;     for (register int i = 1; i <= cnt - 2; i++) ans = ans * n % p;     if (cnt == 1) ans = 1;     printf( %lld , ans % p);     return 0;   }   