#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3fffffff;
const int SINF = 0x7fffffff;
const long long LINF = 0x3fffffffffffffff;
const long long SLINF = 0x7fffffffffffffff;
const int MAXN = 4007;
const int MAXK = 77;
const int MOD = 998244353;
int n1, n2, K;
vector<int> e1[MAXN], e2[MAXN];
int v1[MAXK], v2[MAXK];
int C[MAXK][MAXK];
int dp[MAXN][MAXK], tmp[MAXK];
int cur[MAXN];
void init();
void input();
void work();
void getval(int n, vector<int> e[], int val[]);
void dfs(int now, int fa, vector<int> e[], int val[]);
int add(int x, int y) {
  x += y;
  return (x < MOD) ? x : (x - MOD);
}
void addv(int &x, int y) {
  x += y;
  (x < MOD) ? x : (x -= MOD);
}
int sub(int x, int y) {
  x -= y;
  return (x >= 0) ? x : (x + MOD);
}
void subv(int &x, int y) {
  x -= y;
  (x >= 0) ? x : (x += MOD);
}
int qpow(int a, long long b) {
  long long base = a, ans = 1;
  while (b) {
    if (b & 1) (ans *= base) %= MOD;
    (base *= base) %= MOD;
    b >>= 1;
  }
  return static_cast<int>(ans);
}
int main() {
  init();
  input();
  work();
}
void init() {
  ios::sync_with_stdio(false);
  for (int i = 0; i < MAXK; ++i) {
    C[i][0] = C[i][i] = 1;
    for (int j = 1; j < i; ++j) C[i][j] = add(C[i - 1][j], C[i - 1][j - 1]);
  }
}
void input() {
  scanf("%d%d%d", &n1, &n2, &K);
  int u, v;
  for (int i = 1; i < n1; ++i)
    scanf("%d%d", &u, &v), e1[u].push_back(v), e1[v].push_back(u);
  for (int i = 1; i < n2; ++i)
    scanf("%d%d", &u, &v), e2[u].push_back(v), e2[v].push_back(u);
}
void work() {
  getval(n1, e1, v1);
  getval(n2, e2, v2);
  int ans = 0;
  for (int i = 0; i <= K; ++i)
    addv(ans, static_cast<long long>(C[K][i]) * v1[i] % MOD * v2[K - i] % MOD);
  cout << ans << endl;
}
void getval(int n, vector<int> e[], int val[]) {
  memset(dp, 0, sizeof(dp));
  memset(cur, 0, sizeof(cur));
  dfs(1, -1, e, val);
  val[0] = n;
}
void dfs(int now, int fa, vector<int> e[], int val[]) {
  dp[now][0] = 0;
  for (auto v : e[now]) {
    if (v ^ fa) {
      dfs(v, now, e, val);
      for (int i = 2; i <= K; ++i) addv(dp[now][i], dp[v][i - 2]);
    }
  }
  for (int i = 0; i <= K; ++i) tmp[i] = sub(i ? 0 : 1, dp[now][i]);
  cur[0] = 1;
  for (int i = 1; i <= K; ++i) {
    cur[i] = 0;
    for (int j = 0; j < i; ++j)
      subv(cur[i], static_cast<long long>(cur[j]) * tmp[i - j] % MOD);
    cur[i] = static_cast<long long>(cur[i]) * qpow(tmp[0], MOD - 2) % MOD;
  }
  for (int i = 0; i <= K; ++i)
    for (int j = 1; j <= K - i; ++j)
      addv(val[i + j],
           static_cast<long long>(cur[i]) * dp[now][j] % MOD * j % MOD);
  for (int i = 0; i <= K; ++i) dp[now][i] = cur[i];
}
