#include <bits/stdc++.h>
using namespace std;
int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
struct High {
  int a[60];
  int top;
  High(int x = 0) {
    memset(a, 0, sizeof(a));
    top = 0;
    while (x) {
      a[++top] += x % 10000;
      x /= 10000;
    }
  }
};
High operator*(High A, High B) {
  High C;
  for (int i = 1; i <= A.top; i++)
    for (int j = 1; j <= B.top; j++) C.a[i + j - 1] += A.a[i] * B.a[j];
  C.top = A.top + B.top + 5;
  for (int i = 1; i <= C.top; i++) {
    C.a[i + 1] += C.a[i] / 10000;
    C.a[i] %= 10000;
  }
  while (C.top && !C.a[C.top]) C.top--;
  return C;
}
bool operator>(High A, High B) {
  if (A.top < B.top) return 0;
  if (A.top > B.top) return 1;
  for (int i = A.top; i >= 1; i--) {
    if (A.a[i] < B.a[i]) return 0;
    if (A.a[i] > B.a[i]) return 1;
  }
  return 0;
}
void Print(High A) {
  printf("%d", A.a[A.top]);
  for (int i = A.top - 1; i >= 1; i--) printf("%04d", A.a[i]);
  puts("");
}
int n;
struct edge {
  int t, next;
} e[705 * 2];
int head[705], ne;
High f[705][705];
int s[705];
void Insert(int u, int v) {
  e[++ne] = (edge){v, head[u]};
  head[u] = ne;
}
void Up_date(High &A, High B) {
  if (B > A) A = B;
}
void Dfs(int u, int fa) {
  s[u] = 1;
  f[u][1] = High(1);
  for (int k = head[u]; k; k = e[k].next) {
    int v = e[k].t;
    if (v == fa) continue;
    Dfs(v, u);
    for (int i = s[u]; i >= 0; i--)
      for (int j = s[v]; j >= 0; j--) Up_date(f[u][i + j], f[u][i] * f[v][j]);
    s[u] += s[v];
  }
  for (int j = s[u]; j >= 1; j--) Up_date(f[u][0], f[u][j] * High(j));
}
int main() {
  n = read();
  for (int i = 1; i <= n - 1; i++) {
    int x = read();
    int y = read();
    Insert(x, y);
    Insert(y, x);
  }
  Dfs(1, 0);
  Print(f[1][0]);
  return 0;
}
