#include <bits/stdc++.h>
using namespace std;
double PI = acos(-1);
double EPS = 1e-7;
long long INF = 1000000000;
long long MOD = 1000000007;
long long MAXINT = 2147483647;
long long INFLL = 1000000000000000000LL;
long long MAXLL = 9223372036854775807LL;
long long mx[8] = {-1, 1, 0, 0, -1, -1, 1, 1};
long long my[8] = {0, 0, -1, 1, -1, 1, -1, 1};
long long n[3];
long long m[3];
long long tot;
vector<long long> adj[3][200005];
vector<long long> adj3[3][200005];
vector<long long> adj2[3][200005];
long long dp[3][200005][8];
map<long long, pair<long long, long long> > dp2[3][200005];
long long sz[3][200005];
long long maxi[3];
void traverse(long long id, long long k, long long par) {
  sz[id][k] = 1;
  for (long long(a) = (0); (a) <= ((long long)adj[id][k].size() - 1); (a)++) {
    if (adj[id][k][a] == par) continue;
    adj3[id][k].push_back(adj[id][k][a]);
    traverse(id, adj[id][k][a], k);
    sz[id][k] += sz[id][adj[id][k][a]];
  }
}
void rebuild(long long id, long long k) {
  long long ls = k;
  for (long long(a) = (0); (a) <= ((long long)adj3[id][k].size() - 1); (a)++) {
    long long v = adj3[id][k][a];
    adj2[id][ls].push_back(v);
    rebuild(id, v);
    adj2[id][ls].push_back(++m[id]);
    ls = m[id];
  }
}
pair<long long, long long> precalc(long long id, long long k, long long par) {
  if (dp2[id][k].count(par)) return dp2[id][k][par];
  pair<long long, long long> &ret = dp2[id][k][par];
  ret.first = 1;
  for (long long(a) = (0); (a) <= ((long long)adj[id][k].size() - 1); (a)++) {
    if (adj[id][k][a] == par) continue;
    ret.first += precalc(id, adj[id][k][a], k).first;
    ret.second += precalc(id, adj[id][k][a], k).second;
  }
  ret.second += ret.first * (tot - ret.first);
  return ret;
}
pair<long long, long long> calc(long long id, long long k, long long par) {
  if (dp2[id][k].count(par)) return dp2[id][k][par];
  pair<long long, long long> &ret = dp2[id][k][par];
  if (par) {
    pair<long long, long long> tmp = calc(id, k, 0);
    tmp.second -= tmp.first * (tot - tmp.first);
    tmp.first -= calc(id, par, k).first;
    tmp.second -= calc(id, par, k).second;
    tmp.second += tmp.first * (tot - tmp.first);
    ret = tmp;
  } else {
    ret.first = 1;
    for (long long(a) = (0); (a) <= ((long long)adj[id][k].size() - 1); (a)++) {
      if (adj[id][k][a] == par) continue;
      ret.first += calc(id, adj[id][k][a], k).first;
      ret.second += calc(id, adj[id][k][a], k).second;
    }
    ret.second += ret.first * (tot - ret.first);
  }
  return ret;
}
long long go(long long id, long long k, long long mask) {
  if (dp[id][k][mask] != -1) return dp[id][k][mask];
  long long &ret = dp[id][k][mask];
  long long sze = sz[id][k];
  for (long long(a) = (0); (a) <= (2); (a)++) {
    if (mask & (1 << a)) sze += n[a];
  }
  ret = 0;
  if (n[id] >= k) ret = (long long)sze * (long long)(tot - sze);
  vector<long long> child;
  for (long long(a) = (0); (a) <= ((long long)adj2[id][k].size() - 1); (a)++) {
    child.push_back(adj2[id][k][a]);
  }
  if ((long long)child.size() == 0) {
    for (long long(a) = (0); (a) <= (2); (a)++) {
      if (mask & (1 << a)) ret += maxi[a];
    }
  }
  if ((long long)child.size() == 1) {
    long long maks = 0;
    for (long long(mask2) = (0); (mask2) <= ((1 << 3) - 1); (mask2)++) {
      if ((mask2 & mask) == mask2) {
        long long mask3 = mask ^ mask2;
        long long cur = 0;
        for (long long(a) = (0); (a) <= (2); (a)++) {
          if (mask2 & (1 << a)) cur += maxi[a];
        }
        (maks) = max((maks), (cur + go(id, child[0], mask3)));
      }
    }
    ret += maks;
  }
  if ((long long)child.size() == 2) {
    long long maks = 0;
    for (long long(mask2) = (0); (mask2) <= ((1 << 3) - 1); (mask2)++) {
      if ((mask2 & mask) == mask2) {
        long long res = mask ^ mask2;
        for (long long(mask3) = (0); (mask3) <= ((1 << 3) - 1); (mask3)++) {
          if ((mask3 & res) == mask3) {
            long long mask4 = res ^ mask3;
            long long cur = 0;
            for (long long(a) = (0); (a) <= (2); (a)++) {
              if (mask2 & (1 << a)) cur += maxi[a];
            }
            (maks) = max((maks), (cur + go(id, child[0], mask3) +
                                  go(id, child[1], mask4)));
          }
        }
      }
    }
    ret += maks;
  }
  return ret;
}
int main() {
  for (long long(a) = (0); (a) <= (2); (a)++) scanf("%I64d", &n[a]);
  tot = n[0] + n[1] + n[2];
  m[0] = n[0];
  m[1] = n[1];
  m[2] = n[2];
  for (long long(a) = (0); (a) <= (2); (a)++) {
    for (long long(b) = (1); (b) <= (n[a] - 1); (b)++) {
      long long u, v;
      scanf("%I64d%I64d", &u, &v);
      adj[a][u].push_back(v);
      adj[a][v].push_back(u);
    }
  }
  long long root = 1;
  for (long long(a) = (0); (a) <= (2); (a)++) {
    traverse(a, root, 0);
    rebuild(a, root);
    precalc(a, 1, 0);
    for (long long(b) = (1); (b) <= (n[a]); (b)++) {
      (maxi[a]) = max((maxi[a]), (calc(a, b, 0).second));
    }
  }
  memset(dp, -1, sizeof(dp));
  long long maks = 0;
  for (long long(a) = (0); (a) <= (2); (a)++) {
    (maks) = max((maks), (go(a, 1, 7 ^ (1 << a))));
  }
  cout << maks << endl;
}
