func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long MAXN = 1e5 + 10;   const long long INF = 2e9;   const double PI = acos(-1);   long long n, m, p, pi = 1;   long long fa[MAXN], k;   long long siz[MAXN];   template <typename T>   inline void read(T &a) {     a = 0;     char c = getchar();     long long f = 1;     while (c <  0  || c >  9 ) {       if (c ==  - ) f = -1;       c = getchar();     }     while (c >=  0  && c <=  9 ) {       a = a * 10 + (c ^ 48);       c = getchar();     }     a *= f;   }   long long find(long long x) {     if (x != fa[x]) return fa[x] = find(fa[x]);     return fa[x];   }   void merge(long long x, long long y) {     x = find(x), y = find(y);     if (x == y) return;     siz[x] += siz[y];     fa[y] = x;   }   long long qpow(long long x, long long b) {     long long res = 1;     if (b <= 0) return res;     for (; b; b >>= 1, (x *= x) %= p)       if (b & 1) (res *= x) %= p;     return res;   }   signed main() {     read(n);     read(m);     read(p);     for (long long i = 1; i <= n; ++i) fa[i] = i, siz[i] = 1;     for (long long i = 1, x, y; i <= m; ++i) {       read(x);       read(y);       merge(x, y);     }     for (long long i = 1; i <= n; ++i)       if (fa[i] == i) (pi *= siz[i]) %= p, k++;     if (k < 2)       printf( %d n , 1 % p);     else       printf( %lld n , qpow(n, k - 2) * pi % p);     return 0;   }   