#include <bits/stdc++.h>
using namespace std;
struct road {
  long long x, next;
} r[705 * 2];
struct big {
  long long a[48], len;
  void print() {
    printf("%I64d", a[len]);
    for (long long i = len - 1; i >= 1; i--) {
      if (a[i] / 10000000 == 0) printf("0");
      if (a[i] / 1000000 == 0) printf("0");
      if (a[i] / 100000 == 0) printf("0");
      if (a[i] / 10000 == 0) printf("0");
      if (a[i] / 1000 == 0) printf("0");
      if (a[i] / 100 == 0) printf("0");
      if (a[i] / 10 == 0) printf("0");
      printf("%I64d", a[i]);
    }
    printf("\n");
  }
  bool operator<(big b) const {
    if (len != b.len) return len < b.len;
    for (long long i = len; i >= 1; i--)
      if (a[i] != b.a[i]) return a[i] < b.a[i];
    return 0;
  }
  big operator*(big b) const {
    big c = {0, 0};
    if (!b.len || !len) return c;
    long long x = 0;
    c.len = len + b.len - 1;
    for (long long i = 1; i <= len; i++)
      for (long long j = 1; j <= b.len; j++) {
        c.a[i + j - 1] = c.a[i + j - 1] + a[i] * b.a[j];
      }
    for (long long i = 1; i <= len + b.len; i++)
      c.a[i] += x, x = c.a[i] / 100000000, c.a[i] %= 100000000;
    if (c.a[len + b.len]) c.len++;
    return c;
  }
};
big operator*(big 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;
}
long long N;
long long st[705], w, fa[705];
big ans, f0[705], f1[705], f2[705][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);
  f0[1].print();
  return 0;
}
