#include <iostream>
#include <vector>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cstdio>
#include <queue>
#include <set>
#include <map>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>

#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

const int maxn = 101;
vi e[maxn];
int vis[maxn], tin[maxn], up[maxn];
int T = 0;

void dfs(int v, int p, vector<pii> &st, vector< vector<pii> > &comps) {
    vis[v] = 1;
    tin[v] = up[v] = T++;
    for (int u: e[v]) {
        if (u == p || vis[u] == 2) continue;
        st.pb(mp(v, u));
        if (vis[u] == 0) {
            dfs(u, v, st, comps);
            if (up[u] >= tin[v]) {
                vector<pii> comp;
                do {
                    comp.pb(st.back());
                    st.pop_back();
                } while (comp.back() != mp(v, u));
                comps.pb(comp);
            }
            uin(up[v], up[u]);
        } else if (vis[u] == 1) uin(up[v], tin[u]);
    }
    vis[v] = 2;
}

const i64 P = 1000000000 + 7;

i64 deg(i64 x, i64 d) {
    d %= P - 1;
    if (d < 0) d += P - 1;
    i64 y = 1;
    while (d) {
        if (d & 1) y *= x, y %= P;
        x *= x, x %= P;
        d /= 2;
    }
    return y;
}

int mu[maxn];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);
    cout << fixed;
#ifdef LOCAL_DEFINE
    freopen("input.txt", "rt", stdin);
#endif

    int n, m, k;
    cin >> n >> m >> k;
    forn(i, m) {
        int x, y;
        cin >> x >> y;
        --x; --y;
        e[x].pb(y);
        e[y].pb(x);
    }

    mu[1] = 1;
    for (int i = 1; i < maxn; ++i) {
        for (int j = 2 * i; j < maxn; j += i) mu[j] -= mu[i];
    }

    i64 ans = 1;
    forn(i, n) {
        if (vis[i]) continue;
        vector<pii> st;
        vector< vector<pii> > comps;
        dfs(i, -1, st, comps);
        for (auto w: comps) {
            if (w.size() == 1) {
                ans *= k;
                ans %= P;
                continue;
            }
            set<int> s;
            for (pii p: w) s.insert(p.fi), s.insert(p.se);
            if (s.size() == w.size()) {
                int l = s.size();
                i64 t = 0;
                for (int d1 = 1; d1 <= l; ++d1) {
                    for (int d = d1; d <= l; d += d1) {
                        if (l % d) continue;
                        t += deg(d, -1) * mu[d / d1] * deg(k, d1);
                        t %= P;
                    }
                }
//                cerr << t << '\n';
                if (t < 0) t += P;
                ans *= t; ans %= P;
            } else {
                i64 t = 1;
                forn(i, w.size()) {
                    t *= k + i; t %= P;
                    t *= deg(i + 1, -1); t %= P;
                }
                ans *= t; ans %= P;
            }
        }
    }
    cout << ans << '\n';

#ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}


Measured memory_bytes: 256