#include <bits/stdc++.h>
using namespace std;
struct road {
  long long x, next;
} r[705 * 2];
struct Big_Number {
  long long a[50];
  int len;
  void Reset() {
    memset(a, 0, sizeof(a));
    len = a[1] = 1;
  }
} f2[705][705], f1[705], f0[705];
Big_Number operator+(Big_Number p1, Big_Number p2) {
  int L = max(p1.len, p2.len);
  Big_Number c;
  memset(c.a, 0, sizeof(c.a));
  for (int i = 1; i <= L; i++) c.a[i] = p1.a[i] + p2.a[i];
  for (int i = 1; i <= L; i++)
    if (c.a[i] >= 100000000) c.a[i + 1] += 1, c.a[i] %= 100000000;
  if (c.a[L + 1]) ++L;
  c.len = L;
  return c;
}
Big_Number operator-(Big_Number p1, Big_Number p2) {
  int L = max(p1.len, p2.len);
  Big_Number c;
  memset(c.a, 0, sizeof(c.a));
  for (int i = 1; i <= L; i++) c.a[i] = p1.a[i] - p2.a[i];
  for (int i = 1; i <= L; i++)
    if (c.a[i] < 0) c.a[i + 1] -= 1, c.a[i] += 100000000;
  while (!c.a[L]) --L;
  c.len = L;
  return c;
}
Big_Number operator*(Big_Number p1, Big_Number p2) {
  Big_Number c;
  int L = p1.len + p2.len + 5;
  memset(c.a, 0, sizeof(c.a));
  for (int i = 1; i <= p1.len; i++)
    for (int j = 1; j <= p2.len; j++) c.a[i + j - 1] += p1.a[i] * p2.a[j];
  for (int i = 1; i <= p1.len + p2.len + 5; i++)
    if (c.a[i] >= 100000000)
      c.a[i + 1] += (c.a[i] / 100000000), c.a[i] %= 100000000;
  while (!c.a[L]) --L;
  c.len = L;
  return c;
}
Big_Number operator*(Big_Number p1, long long p2) {
  for (int i = 1; i <= p1.len; i++) p1.a[i] *= p2;
  for (int i = 1; i <= p1.len + 11; i++)
    if (p1.a[i] >= 100000000)
      p1.a[i + 1] += p1.a[i] / 100000000, p1.a[i] %= 100000000;
  p1.len += 11;
  while (!p1.a[p1.len]) p1.len--;
  return p1;
}
bool operator<(Big_Number p1, Big_Number p2) {
  if (p1.len < p2.len) return true;
  if (p1.len > p2.len) return false;
  for (int i = p1.len; i >= 1; i--) {
    if (p1.a[i] < p2.a[i]) return true;
    if (p1.a[i] > p2.a[i]) return false;
  }
  return false;
}
void Print(Big_Number t) {
  printf("%I64d", t.a[t.len]);
  for (int i = t.len - 1; i >= 1; i--) {
    if (t.a[i] < 10000000LL) printf("0");
    if (t.a[i] < 1000000LL) printf("0");
    if (t.a[i] < 100000LL) printf("0");
    if (t.a[i] < 10000LL) printf("0");
    if (t.a[i] < 1000LL) printf("0");
    if (t.a[i] < 100LL) printf("0");
    if (t.a[i] < 10LL) printf("0");
    printf("%I64d", t.a[i]);
  }
  printf("\n");
}
long long N;
long long st[705], w, fa[705];
void add(long long x, long long y) {
  r[++w].x = y;
  r[w].next = st[x];
  st[x] = w;
}
void dfs(long long x) {
  long long i, j, tmp;
  f2[x][1].a[1] = f1[x].a[1] = f2[x][1].len = f1[x].len = 1;
  f0[x].a[1] = f0[x].len = 1;
  for (i = st[x]; i; i = r[i].next) {
    tmp = r[i].x;
    if (fa[x] == tmp) continue;
    fa[tmp] = x, dfs(tmp);
    for (j = N; j >= 1; j--)
      f2[x][j] = max(f1[tmp] * f2[x][j - 1], f2[x][j] * f0[tmp]);
    f0[x] = f0[x] * f0[tmp];
    for (j = 1; j <= N; j++) f0[x] = max(f0[x], f1[x] * (f2[tmp][j] * (j + 1)));
    f1[x] = f1[x] * f0[tmp];
  }
  for (j = 1; j <= N; j++) f0[x] = max(f0[x], f2[x][j] * j);
}
int main() {
  long long i, j, fr, to;
  scanf("%I64d", &N);
  for (i = 1; i < N; i++) {
    scanf("%I64d %I64d", &fr, &to);
    add(fr, to), add(to, fr);
  }
  dfs(1);
  Print(f0[1]);
  return 0;
}
