#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cstdint>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define MP make_pair
#define PB push_back
#define inf 1000000007
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
 
template<class T> inline bool chmax(T &a, T b){
    if(a<b){
        a = b;
        return true;
    }
    return false;
}

template<class T> inline bool chmin(T &a, T b){
    if(a>b){
        a = b;
        return true;
    }
    return false;
}

template <unsigned int mod>
class ModInt {
private:
    unsigned int v;
    static unsigned int norm(const unsigned int& x){ return x < mod ? x : x - mod; }
    static ModInt make(const unsigned int& x){ ModInt m; return m.v = x, m; }
    static ModInt inv(const ModInt& x){ return make(inverse(x.v, mod)); }
    static unsigned int inverse(int a, int m){
        int u[] = {a, 1, 0}, v[] = {m, 0, 1}, t;
        while(*v){
            t = *u / *v;
            swap(u[0] -= t * v[0], v[0]), swap(u[1] -= t * v[1], v[1]), swap(u[2] -= t * v[2], v[2]);
        }
        return (u[1] % m + m) % m;
    }

public:
    ModInt() : v{0}{}
    ModInt(const long long val) : v{norm(val % mod + mod)} {}
    ModInt(const ModInt<mod>& n) : v{n()} {}
    explicit operator bool() const noexcept { return v != 0; }
    bool operator!() const noexcept { return !static_cast<bool>(*this); }
    ModInt& operator=(const ModInt& n){ return v = n(), (*this); }
    ModInt& operator=(const long long val){ return v = norm(val % mod + mod), (*this); }
    ModInt operator+() const { return *this; }
    ModInt operator-() const { return v == 0 ? make(0) : make(mod - v); }
    ModInt operator+(const ModInt& val) const { return make(norm(v + val())); }
    ModInt operator-(const ModInt& val) const { return make(norm(v + mod - val())); }
    ModInt operator*(const ModInt& val) const { return make((long long)v * val() % mod); }
    ModInt operator/(const ModInt& val) const { return *this * inv(val); }
    ModInt& operator+=(const ModInt& val){ return *this = *this + val; }
    ModInt& operator-=(const ModInt& val){ return *this = *this - val; }
    ModInt& operator*=(const ModInt& val){ return *this = *this * val; }
    ModInt& operator/=(const ModInt& val){ return *this = *this / val; }
    ModInt operator+(const long long val) const { return ModInt{v + val}; }
    ModInt operator-(const long long val) const { return ModInt{v - val}; }
    ModInt operator*(const long long val) const { return ModInt{(long long)v * (val % mod)}; }
    ModInt operator/(const long long val) const { return ModInt{(long long)v * inv(val)}; }
    ModInt& operator+=(const long long val){ return *this = *this + val; }
    ModInt& operator-=(const long long val){ return *this = *this - val; }
    ModInt& operator*=(const long long val){ return *this = *this * val; }
    ModInt& operator/=(const long long val){ return *this = *this / val; }
    bool operator==(const ModInt& val) const { return v == val.v; }
    bool operator!=(const ModInt& val) const { return !(*this == val); }
    bool operator==(const long long val) const { return v == norm(val % mod + mod); }
    bool operator!=(const long long val) const { return !(*this == val); }
    unsigned int operator()() const { return v; }
    friend ModInt operator+(const long long val, const ModInt& n) { return n + val; }
    friend ModInt operator-(const long long val, const ModInt& n) { return ModInt{val - n()}; }
    friend ModInt operator*(const long long val, const ModInt& n) { return n * val; }
    friend ModInt operator/(const long long val, const ModInt& n) { return ModInt{val} / n; }
    friend bool operator==(const long long val, const ModInt& n) { return n == val; }
    friend bool operator!=(const long long val, const ModInt& n) { return !(val == n); }
    friend istream& operator>>(istream& is, ModInt& n){
        unsigned int v;
        return is >> v, n = v, is;
    }
    friend ostream& operator<<(ostream& os, const ModInt& n){ return (os << n()); }
    friend ModInt mod_pow(ModInt x, long long n){
        ModInt ans = 1;
        while(n){
            if(n & 1) ans *= x;
            x *= x, n >>= 1;
        }
        return ans;
    }
};

#define MOD 1000000007
using mod = ModInt<MOD>;

#define MAX_N 200000
mod inv[MAX_N],fac[MAX_N],finv[MAX_N];

void make()
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i=2;i<MAX_N;i++){
        inv[i] = MOD - inv[MOD % i] * (MOD / i);
        fac[i] = fac[i-1] * i;
        finv[i] = finv[i-1] * inv[i];
    }
}

mod comb(int a, int b)
{
    if(a<b) return 0;
    return fac[a] * finv[b] * finv[a-b];
}


// 関節点を求めるアルゴリズム(計算量は線形)
// 自己ループは存在しないことを仮定
class Articulation {
public:
    struct bcnode;
private:
	const int V;
    vector<int> ord, low;
    bool check(const int u){
        for(const int v : G[u]){
            if(ord[v] < 0) return true;
        }
        return false;
    }
    void identify_block(const int u, const int v, bool *used, 
                            stack<pair<int, int> >& st, const vector<int>& bcnode_id){
        vector<pair<int, int> > block;
        vector<int> cut_vertex;
        while(!st.empty()){
            const pair<int, int> p = st.top();
            st.pop(), block.push_back(p);
            if(art[p.first] && !used[p.first]){
                cut_vertex.push_back(p.first);
                used[p.first] = true;
            }
            if(art[p.second] && !used[p.second]){
                cut_vertex.push_back(p.second);
                used[p.second] = true;
            }
            if(p == (pair<int, int>){u, v}) break;
        }
        const int block_id = (int)bctree.size();
        bctree.push_back(vector<int>());
        bcnodes.emplace_back(true, move(block));
        for(const int ver : cut_vertex){
            bctree[block_id].push_back(bcnode_id[ver]);
            bctree[bcnode_id[ver]].push_back(block_id);
            used[ver] = false;
        }
    }
	void dfs(const int u, const int p, int& tm, bool *used,
                stack<pair<int, int> >& st, vector<int>& bcnode_id){
		ord[u] = low[u] = tm++;
        bool multi_edge = false;
		for(const int v : G[u]){
			if(ord[v] < 0){
                st.push({u, v});
				dfs(v, u, tm, used, st, bcnode_id);
				low[u] = min(low[u], low[v]);
				if(ord[u] <= low[v]){
                    if(!art[u] && (p >= 0 || check(u))){
                        art[u] = true;
                        bcnode_id[u] = (int)bctree.size();
                        bctree.push_back(vector<int>());
                        bcnodes.emplace_back(false, vector<pair<int, int> >{{u, u}});
                    }
                    identify_block(u, v, used, st, bcnode_id);
                }
			}else if(v == p){
                if(multi_edge){
                    st.push({u, v});
                    low[u] = min(low[u], ord[v]);
                }else{
                    multi_edge = true;
                }
			}else if(ord[v] < ord[u]){
                st.push({u, v});
                low[u] = min(low[u], ord[v]);
            }
		}
	}
public:
    vector<vector<int> > G;
    vector<bool> art;
    struct bcnode {
        bool isBlock; // true: block, false: cut
        vector<pair<int, int> > component;
        bcnode(bool _isBlock, vector<pair<int, int> >&& _component)
            : isBlock(_isBlock), component(move(_component)){}
    };
    vector<vector<int> > bctree;
    vector<bcnode> bcnodes;
    Articulation(const int node_size)
        : V(node_size), ord(V, -1), low(V), G(V), art(V, false){}
    void add_edge(const int a, const int b){
        G[a].push_back(b), G[b].push_back(a);
    }
	int solve(){
		int tm = 0;
        bool *used = new bool[V]();
        stack<pair<int, int> > st;
        vector<int> bcnode_id(V, -1); // bcnode_id[original vertex] = cut vertex;
        for(int i = 0; i < V; ++i){
			if(ord[i] < 0) dfs(i, -1, tm, used, st, bcnode_id);
		}
        delete[] used;
        return (int)bctree.size();
	}
};

template<typename T>
vector<T> divisor(T n)
{
    vector<T> res;
    for(T i=1;(long long)i*i<=n;i++){
        if(n%i==0){
            res.push_back(i);
            if(i != n/i){
                res.push_back(n/i);
            }
        }
    }
    sort(all(res));
    return res;
}

mod dp[101];
mod dp2[101];
int main(){
    make();
    int n,m,k;
    cin >> n >> m >> k;
    for(int i=1;i<=100;i++){
        dp[i] = mod_pow((mod)k,i);
        vector<int> d = divisor(i);
        for(auto x:d){
            if(x!=i){
                dp[i] -= dp[x];
            }
        }
    }
    for(int i=1;i<=100;i++){
        dp[i] /= i;
        for(int j=i;j<=100;j+=i){
            dp2[j] += dp[i];
        }
        
    }
    vector<pair<int,int> > p;
    Articulation art(n);
    rep(i,m){
        int a,b;
        cin >> a >> b;
        a--;b--;
        art.add_edge(a,b);
        p.push_back(MP(a,b));
    }
    art.solve();
    vector<int> s,t;
    for(auto &x:art.bcnodes){
        if(!x.isBlock)continue;
        auto &v = x.component;
        if(v.size()!=0){
            t.push_back(v.size());
            set<int> st;
            for(auto yy:v){
                st.insert(yy.first);
                st.insert(yy.second);
            }
            s.push_back(st.size());
        }
    }
    mod res = 1;
    rep(i,s.size()){
        cerr << s[i] << " " << t[i] << endl;
        if(t[i]==1){
            res *= k;
        }else if(t[i]==s[i]){
            res *= dp2[t[i]];
        }else{
            res *= comb(t[i]+k-1,k-1);
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 5576