/*----------------by syr----------------*/
/*

         iii                  ii
     rBQBBBBBBE       BBR iBBBBQBBL     XBBBBBBQBBBBB
   iBBQJ    7BBB      BBsSBBr   BBQ      i      cBBB
  rBBU       iBBw     BBBQi     HBBi           KBBi
  BBH         BB5    iBBB       isL          wBB5
 GBB         iBBi    6BB                   iBBB
 BBQ         BQB     BBD                  QBBi
 BBB        BQB     iQBi                1BBv
 sBBg     wBBB      QBB               iBBB
  7BBBBBBBBBi       BBR              wBBBBBBBBBBBBB
     irvi           ii               ii    i i iii
                i5U
               BBB
               BB7
              1BB
      iPBBBBBKBBR    JBR1       rQBO   BR  UBQP  iBBQi
    7BBBGs7sXBBBi     QBBr     gBBE   rBB BB2BB7HBZQBB
   QBBi      sBQ       BBB   iBBB     SQBBR  BBBB  cBQ
  gBQ        BBg        BBB KBBi      MBBH   BBB   BBs
 iBBv       iBBi         QBBBL        BBR   pBB   iBB
 pBB        BBB         iBBBB        iBB    BBL   KBB
 MBB       BBBR        BBB JBBi      DBR   iBQ    BBL
 GBB     7BBBB2      PBBH   BBBi     BQr   DBB   iBB
  BQBXwgBBP BB7    1BBB      BBQ7   1BB    BBc   BBB
   2BBBBw   BB    EBBS        QBBi  HBa   iBB    BB7
*/
#include<bits/stdc++.h>

using namespace std;

#define PH push
#define MP make_pair
#define PB push_back
#define fst first
#define snd second
#define FOR(i, x, y) for(int i = (x); i < (y); ++i)
#define REP(i, x, y) for(int i = (x); i <= (y); ++i)
#define x0 x0123456789
#define y0 y0123456789
#define x1 x1234567890
#define y1 y1234567890
#define x2 x2345678901
#define y2 y2345678901
typedef double db;
typedef long long ll;
typedef long double ldb;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1e9 + 7;
const int maxn = 205;

int n, m, k, col = 0;
int sim[maxn], edg[maxn], beg[maxn], bel[maxn], ver[maxn];
ll ans = 1;
ll pw[maxn], dp[maxn][maxn], sum[maxn][maxn];
vector<int> g[maxn];

int qpow(ll x, ll y){
	ll ret = 1;
	for(; y; y >>= 1){
		if(y & 1) (ret *= x) %= INF;
		(x *= x) %= INF;
	}
	return ret;
}

namespace Tarjan{
	int clk = 0, top = 0, tot = 0;
	int low[maxn], dfn[maxn], stk[maxn];
	int have[maxn][maxn];
	void tarjan(int u, int fa){
		low[u] = dfn[u] = ++clk;
		stk[++top] = u;
		FOR(i, 0, g[u].size()){
			int v = g[u][i];
			if(v == fa) continue;
			if(dfn[v]) low[u] = min(low[u], dfn[v]);
			else{
				tarjan(v, u);
				low[u] = min(low[u], low[v]);
				if(low[v] >= dfn[u]){
					beg[col] = tot;
					for(; stk[top + 1] != v; --top) ver[tot++] = stk[top], have[stk[top]][col] = true;
					ver[tot++] = u;
					have[u][col] = true;
					++col;
				}
			}
		}
		return;
	}
	void work(){
		FOR(i, 0, n) if(!dfn[i]) tarjan(i, -1);
		beg[col] = tot;
		FOR(c, 0, col){
			sim[c] = true;
			if(beg[c] + 2 == beg[c + 1]){
				(ans *= k) %= INF;
				continue;
			}
			FOR(i, beg[c], beg[c + 1]){
				int u = ver[i];
				int e = 0;
				FOR(j, 0, g[u].size()){
					int v = g[u][j];
					if(have[v][c]) ++e;
				}
				edg[c] += e;
				sim[c] &= (e == 2);
			}
		}
		return;
	}
}

int polya(int e){
	ll ret = 0;
	REP(i, 1, e){
		(ret += pw[__gcd(i, e)]) %= INF;
	}
	(ret *= qpow(e, INF - 2)) %= INF;
	return ret;
}

int main(){
	scanf("%d%d%d", &n, &m, &k);
	pw[0] = 1;
	REP(i, 1, m) pw[i] = pw[i - 1] * k % INF;
	FOR(i, 0, m){
		int u, v; scanf("%d%d", &u, &v); --u, --v;
		g[u].PB(v);
		g[v].PB(u);
	}
	Tarjan::work();
	dp[0][0] = 1;
	REP(i, 0, k) REP(j, 0, m){
		if(i) dp[i][j] = sum[i - 1][j];
		sum[i][j] = ((j ? sum[i][j - 1] : 0) + dp[i][j]) % INF;
	}
	FOR(c, 0, col) if(beg[c] + 2 != beg[c + 1]){
		edg[c] /= 2;
		if(!sim[c]){
			(ans *= dp[k][edg[c]]) %= INF;
		}
		else{
			(ans *= polya(edg[c])) %= INF;
		}
	}
	printf("%lld\n", ans);
	return 0;
}



Measured memory_bytes: 640