#include<bits/stdc++.h>

#define fec(i, x, y) (int i = head[x], y = g[i].to; i; i = g[i].ne, y = g[i].to)
#define dbg(...) fprintf(stderr, __VA_ARGS__)
#define File(x) freopen(#x".in", "r", stdin), freopen(#x".out", "w", stdout)
#define fi first
#define se second
#define pb push_back

template<typename A, typename B> inline char smax(A &a, const B &b) {return a < b ? a = b , 1 : 0;}
template<typename A, typename B> inline char smin(A &a, const B &b) {return b < a ? a = b , 1 : 0;}

typedef long long ll; typedef unsigned long long ull; typedef std::pair<int, int> pii;

template<typename I>
inline void read(I &x) {
	int f = 0, c;
	while (!isdigit(c = getchar())) c == '-' ? f = 1 : 0;
	x = c & 15;
	while (isdigit(c = getchar())) x = (x << 1) + (x << 3) + (c & 15);
	f ? x = -x : 0;
}

const int N = 50 + 7;
const int M = 100 + 7;
const int P = 1e9 + 7;

int n, m, k, ans, tp, dfc;
int inv[M << 1], fac[M << 1], ifac[M << 1], pw[M << 1];
int dfn[N], low[N], s[M], hh[M], ss[M << 1];

struct Edge { int to, ne; } g[M << 1]; int head[N], tot = 1;
inline void addedge(int x, int y) { g[++tot].to = y, g[tot].ne = head[x], head[x] = tot; }
inline void adde(int x, int y) { addedge(x, y), addedge(y, x); }

inline int smod(int x) { return x >= P ? x - P : x; }
inline void sadd(int &x, int y) { x += y; x >= P ? x -= P : x; }
inline int fpow(int x, int y) {
	int ans = 1;
	for (; y; y >>= 1, x = (ll)x * x % P) if (y & 1) ans = (ll)ans * x % P;
	return ans;
}

inline void ycl(const int &n) {
	fac[0] = 1; for (int i = 1; i <= n; ++i) fac[i]  = (ll)fac[i - 1] * i % P;
	inv[1] = 1; for (int i = 2; i <= n; ++i) inv[i] = (ll)(P - P / i) * inv[P % i] % P;
	ifac[0] = 1; for (int i = 1; i <= n; ++i) ifac[i] = (ll)ifac[i - 1] * inv[i] % P;
	pw[0] = 1; for (int i = 1; i <= n; ++i) pw[i] = (ll)pw[i - 1] * k % P;
}
inline int C(int x, int y) {
	if (x < y) return 0;
	return (ll)fac[x] * ifac[y] % P * ifac[x - y] % P;
}

inline void dfs(int x, int fa = 0) {
	dfn[x] = low[x] = ++dfc;
	for fec(i, x, y) if (y != fa) {
		if (!dfn[y]) {
			s[++tp] = i >> 1;
			dfs(y, x);
			smin(low[x], low[y]);
			if (low[y] >= dfn[x]) {
				hh[0] = 0;
				while (1) {
					int z = s[tp--];
					hh[++hh[0]] = z;
//					dbg("%d\n", z);
					if (z == i >> 1) break;
				}
//				dbg("\n");
				if (hh[0] == 1) { ans = (ll)ans * k % P; /*dbg("type: 1\n\n"); */continue;}
				ss[0]  = 0;
				for (int i = 1; i <= hh[0]; ++i) ss[++ss[0]] = g[hh[i] << 1].to, ss[++ss[0]] = g[hh[i] << 1 | 1].to;
				std::sort(ss + 1, ss + ss[0] + 1);
				ss[0] = std::unique(ss + 1, ss + ss[0] + 1) - ss - 1;
				if (ss[0] != hh[0]) { ans = (ll)ans * C(hh[0] + k - 1, k - 1) % P; /*dbg("type: 2\n\n"); */continue;}
				int cnt = 0;
				for (int i = 0; i < hh[0]; ++i) sadd(cnt, pw[std::__gcd(i, hh[0])]);
//				dbg("cnt = %d\n", cnt);
				ans = (ll)ans * cnt % P * inv[hh[0]] % P;
//				dbg("type: 3\n\n");
			}
		} else smin(low[x], dfn[y]), dfn[y] < dfn[x] ? s[++tp] = i >> 1 : 0;
	}
}

inline void tarjan() {
	for (int i = 1; i <= n; ++i)
		if (!dfn[i]) dfs(i);
}

inline void work() {
	ycl(m + k);
	ans = 1;
	tarjan();
	printf("%d\n", ans);
}

inline void init() {
	read(n), read(m), read(k);
	for (int i = 1; i <= m; ++i) {
		int x, y;
		read(x), read(y);
		adde(x, y);
	}
}

int main() {
	#ifdef hzhkk
	freopen("hkk.in", "r", stdin);
	#endif
	init();
	work();
	fclose(stdin), fclose(stdout);
	return 0;
}

Measured memory_bytes: 256