#include <bits/stdc++.h>
using namespace std;
int N;
struct Edge {
  int v;
  Edge *next;
} e[710 << 1], *ind_e[710];
int e_tot;
void BuildEdge(int u, int v) {
  Edge *p = &e[e_tot++];
  p->v = v;
  p->next = ind_e[u];
  ind_e[u] = p;
}
int par[710];
double lg[710];
void Init() {
  e_tot = 0;
  memset(ind_e, 0, sizeof(ind_e));
  scanf("%d", &N);
  for (int i = 1; i < N; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    BuildEdge(u, v);
    BuildEdge(v, u);
  }
  for (int i = 1; i <= N; i++) lg[i] = log((double)i);
}
int q[710];
int sz[710];
void BFS() {
  int f = 0, r = 1;
  memset(par, 0, sizeof(par));
  par[1] = -1;
  q[0] = 1;
  while (f < r) {
    int now = q[f++];
    for (Edge *p = ind_e[now]; p; p = p->next)
      if (!par[p->v]) {
        par[p->v] = now;
        q[r++] = p->v;
      }
  }
  for (int i = N - 1; i >= 0; i--) {
    int x = q[i];
    sz[x] = 1;
    for (Edge *p = ind_e[x]; p; p = p->next)
      if (p->v != par[x])
        sz[x] += sz[p->v];
      else
        p->v = -1;
  }
}
struct BigInt {
  int len;
  int n[30];
} ans;
void Mul(int c) {
  for (int i = ans.len - 1; i >= 0; i--) {
    ans.n[i] *= c;
    ans.n[i + 1] += ans.n[i] / 10000;
    ans.n[i] %= 10000;
  }
  for (int i = 0; i <= ans.len; i++) {
    ans.n[i + 1] += ans.n[i] / 10000;
    ans.n[i] %= 10000;
  }
  if (ans.n[ans.len]) ans.len++;
}
bool mf[710][710], mg[710 << 1][710];
double f[710][710], g[710 << 1][710];
int soluf[710], solug[710 << 1][710];
double F(int, int);
void F_(int, int);
double G(int, int);
void G_(int, int);
double F(int now, int left) {
  if (mf[now][left]) return f[now][left];
  mf[now][left] = 1;
  if (left) {
    return f[now][left] = G(ind_e[now] - e, left - 1);
  } else {
    double ret = -1;
    for (int i = 0; i < sz[now]; i++) {
      double t = G(ind_e[now] - e, i) + lg[i + 1];
      if (ret < t) {
        ret = t;
        soluf[now] = i;
      }
    }
    return f[now][left] = ret;
  }
}
void F_(int now, int left) {
  if (left) {
    G_(ind_e[now] - e, left - 1);
  } else {
    Mul(soluf[now] + 1);
    G_(ind_e[now] - e, soluf[now]);
  }
}
double G(int id, int left) {
  if (id < 0) return left ? -lg[N] : 0;
  if (mg[id][left]) return g[id][left];
  mg[id][left] = 1;
  int v = e[id].v, next = e[id].next - e;
  if (v == -1) return g[id][left] = G(next, left);
  if (!left) {
    return g[id][left] = F(v, 0) + G(next, 0);
  } else {
    double ret = -lg[N];
    int s;
    for (int i = min(sz[v], left); i >= 0; i--) {
      double t = G(next, left - i);
      if (t < 0) break;
      t += F(v, i);
      if (ret < t) {
        ret = t;
        s = i;
      }
    }
    solug[id][left] = s;
    return g[id][left] = ret;
  }
}
void G_(int id, int left) {
  if (id < 0) return;
  if (e[id].v == -1) {
    G_(e[id].next - e, left);
    return;
  }
  if (!left) {
    F_(e[id].v, 0);
    G_(e[id].next - e, 0);
  } else {
    F_(e[id].v, solug[id][left]);
    G_(e[id].next - e, left - solug[id][left]);
  }
}
int main() {
  Init();
  BFS();
  memset(mf, 0, sizeof(mf));
  memset(mg, 0, sizeof(mg));
  F(1, 0);
  ans.len = ans.n[0] = 1;
  F_(1, 0);
  printf("%d", ans.n[ans.len - 1]);
  for (int i = ans.len - 2; i >= 0; i--) printf("%04d", ans.n[i]);
  return 0;
}
