#include <bits/stdc++.h>
using namespace std;
int n, sz[777];
int M = 0, fst[666666], vb[666666], nxt[666666];
void ad_de(int a, int b) {
  ++M;
  nxt[M] = fst[a];
  fst[a] = M;
  vb[M] = b;
}
void adde(int a, int b) {
  ad_de(a, b);
  ad_de(b, a);
}
typedef pair<double, int> F;
F dp[777][777], fs[777][777], tmp[777];
double lg[777];
vector<F*> ds[777];
vector<int> son[777];
void dfs(int x, int f = 0) {
  ds[x].push_back(dp[x]);
  for (int e = fst[x], c = vb[e]; e; e = nxt[e], c = vb[e])
    if (c != f) ds[x].push_back(fs[c]);
  int t = 0;
  ds[x][t][1] = make_pair(0.0, 0);
  sz[x] = 1;
  for (int e = fst[x], c = vb[e]; e; e = nxt[e], c = vb[e])
    if (c != f) {
      dfs(c, x);
      son[x].push_back(c);
      F* tmp = ds[x][t + 1];
      for (int a = 1; a <= sz[x] + sz[c]; ++a) tmp[a] = make_pair(-1e233, 0);
      for (int a = 1; a <= sz[x]; ++a)
        for (int b = 1; b <= sz[c]; ++b)
          tmp[a + b] =
              max(tmp[a + b], make_pair(ds[x][t][a].first +
                                            ds[c][ds[c].size() - 1][b].first -
                                            lg[a] - lg[b] + lg[a + b],
                                        b * 2));
      for (int a = 1; a <= sz[x]; ++a)
        for (int b = 1; b <= sz[c]; ++b)
          tmp[a] = max(tmp[a], make_pair(ds[x][t][a].first +
                                             ds[c][ds[c].size() - 1][b].first,
                                         b * 2 + 1));
      for (int a = 1; a <= sz[x] + sz[c]; ++a) dp[x][a] = tmp[a];
      sz[x] += sz[c];
      ++t;
    }
}
int ff[666666], ss[666666];
int gf(int x) { return ff[x] ? ff[x] = gf(ff[x]) : x; }
void dfs2(int x, int w) {
  reverse(son[x].begin(), son[x].end());
  int g = ds[x].size() - 1;
  for (int i = 0; i < son[x].size(); ++i) {
    int c = son[x][i], gg = ds[x][g--][w].second;
    dfs2(c, gg / 2);
    if (!(gg & 1)) w -= gg / 2, ff[c] = x;
  }
}
long long s[1000];
int main() {
  memset(dp, -127 / 3, sizeof dp);
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) lg[i] = log(i);
  for (int i = 2, a, b; i <= n; ++i) scanf("%d%d", &a, &b), adde(a, b);
  dfs(1);
  pair<double, int> ma(-1e233, 0);
  for (int i = 1; i <= n; ++i)
    ma = max(ma, make_pair(ds[1][ds[1].size() - 1][i].first, i));
  dfs2(1, ma.second);
  for (int i = 1; i <= n; ++i) ++ss[gf(i)];
  s[0] = 1;
  for (int i = 1; i <= n; ++i) {
    if (!ss[i]) continue;
    for (int j = 0; j < 1000; ++j) s[j] *= ss[i];
    for (int j = 0; j + 1 < 1000; ++j) s[j + 1] += s[j] / 10, s[j] %= 10;
  }
  int g = 1000 - 1;
  while (!s[g]) --g;
  while (~g) putchar(s[g--] + 48);
}
