#include <bits/stdc++.h>
const int N = 701, bit = 10000;
using namespace std;
struct st {
  int l, a[101];
} f[N][N], bas[N];
struct st2 {
  int to, next;
} e[N << 1];
int n, i, x, y, cnt, fi[N], num[N];
void add(int x, int y) {
  e[++cnt].to = y;
  e[cnt].next = fi[x];
  fi[x] = cnt;
  e[++cnt].to = x;
  e[cnt].next = fi[y];
  fi[y] = cnt;
}
st operator*(st a, st b) {
  st c;
  for (int i = 0; i <= 100; i++) c.a[i] = 0;
  c.l = a.l + b.l - 1;
  for (int i = 1; i <= a.l; i++)
    for (int j = 1; j <= b.l; j++) c.a[i + j - 1] += a.a[i] * b.a[j];
  for (int i = 1; i <= c.l; i++) c.a[i + 1] += c.a[i] / bit, c.a[i] %= bit;
  for (; c.a[c.l + 1]; c.l++)
    c.a[c.l + 2] = c.a[c.l + 1] / bit, c.a[c.l + 1] %= bit;
  return c;
}
bool operator>(st a, st b) {
  if (a.l > b.l) return 1;
  if (a.l < b.l) return 0;
  for (int i = a.l; i; i--)
    if (a.a[i] > b.a[i])
      return 1;
    else if (a.a[i] < b.a[i])
      return 0;
  return 0;
}
void dp(int x, int fa) {
  num[x] = 1;
  f[x][0].l = f[x][1].l = f[x][0].a[1] = f[x][1].a[1] = 1;
  for (int i = fi[x]; i; i = e[i].next)
    if (e[i].to != fa) {
      int y = e[i].to;
      dp(y, x);
      for (int j = num[x]; j >= 0; j--)
        for (int k = num[y]; k >= 0; k--) {
          st t = f[x][j] * f[y][k];
          if (t > f[x][j + k]) f[x][j + k] = t;
        }
      num[x] += num[y];
    }
  for (int i = 1; i <= num[x]; i++) {
    st t = bas[i] * f[x][i];
    if (t > f[x][0]) f[x][0] = t;
  }
}
int main() {
  scanf("%d\n", &n);
  for (i = 1; i <= n; i++) bas[i].l = 1, bas[i].a[1] = i;
  for (i = 1; i < n; i++) {
    scanf("%d%d\n", &x, &y);
    add(x, y);
  }
  dp(1, 0);
  printf("%d", f[1][0].a[f[1][0].l--]);
  for (; f[1][0].l;) printf("%04d", f[1][0].a[f[1][0].l--]);
}
