#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
const long long Inf = 1e18;
const int N = 4010;
const int mod = 998244353;
int gi() {
  int x = 0, o = 1;
  char ch = getchar();
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') o = -1, ch = getchar();
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return x * o;
}
template <typename T>
bool chkmax(T &a, T b) {
  return a < b ? a = b, 1 : 0;
};
template <typename T>
bool chkmin(T &a, T b) {
  return a > b ? a = b, 1 : 0;
};
int add(int a, int b) { return a + b >= mod ? a + b - mod : a + b; }
int sub(int a, int b) { return a - b < 0 ? a - b + mod : a - b; }
void inc(int &a, int b) { a = (a + b >= mod ? a + b - mod : a + b); }
void dec(int &a, int b) { a = (a - b < 0 ? a - b + mod : a - b); }
int n, k, C[80][80];
struct tree {
  int n;
  vector<int> E[N];
  int id[N][N], s[80][N], ans[80];
  vector<int> f[80][N];
  void read() {
    for (int i = 1, u, v; i < n; i++)
      u = gi(), v = gi(), E[u].push_back(v), E[v].push_back(u);
    for (int u = 1; u <= n; u++)
      for (int i = 0; i < int(E[u].size()); i++)
        for (int v = 0; v < int(E[E[u][i]].size()); v++)
          if (E[E[u][i]][v] == u) id[u][i] = v;
  }
  void work() {
    for (int k = 0; k <= ::k; k += 2) {
      for (int u = 1; u <= n; u++) {
        f[k][u].resize(int(E[u].size()) + 1);
        if (k == 0) {
          for (int v = 0; v <= int(E[u].size()); v++) f[k][u][v] = 1;
        } else {
          for (int v = 0; v <= int(E[u].size()); v++)
            for (int t = 0; t <= k - 2; t += 2) {
              if (v == int(E[u].size()))
                inc(f[k][u][v], 1ll * s[t][u] * f[k - t - 2][u][v] % mod);
              else
                inc(f[k][u][v], 1ll * sub(s[t][u], f[t][E[u][v]][id[u][v]]) *
                                    f[k - t - 2][u][v] % mod);
            }
        }
      }
      for (int u = 1; u <= n; u++) {
        for (int v = 0; v < int(E[u].size()); v++)
          inc(s[k][u], f[k][E[u][v]][id[u][v]]);
        inc(ans[k], f[k][u][int(E[u].size())]);
      }
    }
  }
} t1, t2;
int main() {
  cin >> t1.n >> t2.n >> k;
  for (int i = 0; i <= k; i++) {
    C[i][0] = 1;
    for (int j = 1; j <= i; j++) C[i][j] = add(C[i - 1][j], C[i - 1][j - 1]);
  }
  t1.read();
  t2.read();
  t1.work();
  t2.work();
  int ans = 0;
  for (int i = 0; i <= k; i += 2)
    inc(ans, 1ll * t1.ans[i] * t2.ans[k - i] % mod * C[k][i] % mod);
  printf("%d\n", ans);
  return 0;
}
