#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int MAXN = 705;
const int L = 10000;
struct number {
  int a[100];
} f[705][705];
number operator*(number x, number y) {
  number z;
  memset(z.a, 0, sizeof(z.a));
  for (int i = 1; i <= x.a[0]; ++i)
    for (int j = 1; j <= y.a[0]; ++j) z.a[i + j - 1] += x.a[i] * y.a[j];
  z.a[0] = x.a[0] + y.a[0] - 1;
  for (int i = 1; i <= z.a[0]; ++i) {
    z.a[i + 1] += z.a[i] / 10000;
    z.a[i] %= 10000;
  }
  if (z.a[z.a[0] + 1]) ++z.a[0];
  return z;
}
number max(number x, number y) {
  if (x.a[0] > y.a[0]) return x;
  if (x.a[0] < y.a[0]) return y;
  for (int i = x.a[0]; i; --i)
    if (x.a[i] > y.a[i])
      return x;
    else if (x.a[i] < y.a[i])
      return y;
  return x;
}
number change(int x) {
  number a;
  a.a[0] = 1;
  a.a[1] = x;
  return a;
}
void print(number x) {
  printf("%d", x.a[x.a[0]]);
  for (int i = x.a[0] - 1; i; --i) printf("%.4d", x.a[i]);
}
int n, len;
int head[MAXN], size[MAXN];
struct Edge {
  int to, next;
} e[MAXN << 1];
void add(int u, int v) {
  e[++len].to = v;
  e[len].next = head[u];
  head[u] = len;
}
void dfs(int u, int fa) {
  size[u] = 1;
  f[u][1].a[0] = f[u][1].a[1] = 1;
  for (int i = head[u]; i != -1; i = e[i].next) {
    int v = e[i].to;
    if (v == fa) continue;
    dfs(v, u);
    for (int j = size[u]; j >= 0; j--) {
      for (int k = size[v]; k >= 0; k--)
        f[u][j + k] = max(f[u][j + k], f[u][j] * f[v][k]);
    }
    size[u] += size[v];
  }
  for (int i = 1; i <= size[u]; i++)
    f[u][0] = max(f[u][0], f[u][i] * change(i));
}
int main() {
  memset(head, -1, sizeof(head));
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    add(x, y);
    add(y, x);
  }
  dfs(1, 0);
  print(f[1][0]);
  return 0;
}
