#include <bits/stdc++.h>
using namespace std;
const int mod = 10000;
int num[2005], first[2005], n, u, v, tot;
struct info {
  int to, next;
} e[2005];
void add(int x, int y) {
  tot++;
  e[tot].to = y;
  e[tot].next = first[x];
  first[x] = tot;
}
struct tar {
  int a[80], n;
  tar(){};
  tar(int x) {
    memset(a, 0, sizeof(a));
    n = 1, a[0] = x;
  }
  void init(int x) { n = 1, a[0] = x; }
  bool operator<(const tar &x) {
    if (n < x.n)
      return 1;
    else if (n > x.n)
      return 0;
    for (int i = n - 1; i >= 0; i--)
      if (a[i] < x.a[i])
        return 1;
      else if (a[i] > x.a[i])
        return 0;
    return 0;
  }
  tar operator*(const tar &x) {
    tar t(0);
    t.n = x.n + n - 1;
    for (int i = 0; i < n; i++)
      for (int j = 0; j < x.n; j++) t.a[i + j] += a[i] * x.a[j];
    for (int i = 0; i < t.n; i++) {
      t.a[i + 1] += t.a[i] / mod;
      t.a[i] %= mod;
    }
    if (t.a[t.n]) t.n++;
    return t;
  }
  tar operator+(const tar x) {
    tar t(0);
    t.n = max(x.n, n);
    for (int i = 0; i < t.n; i++) {
      t.a[i] = t.a[i] + x.a[i] + a[i];
      t.a[i + 1] += t.a[i] / mod;
      t.a[i] %= mod;
    }
    if (t.a[t.n]) ++t.n;
    return t;
  }
  void print() {
    printf("%d", a[n - 1]);
    for (int i = n - 2; i >= 0; i--) printf("%04d", a[i]);
    puts(" ");
  }
} dp[705][705];
void dfs(int u, int fa) {
  num[u] = 1;
  dp[u][0] = (0);
  dp[u][1] = (1);
  for (int p = first[u]; p; p = e[p].next) {
    int v = e[p].to;
    if (v == fa) continue;
    dfs(v, u);
    for (int i = num[u]; i >= 0; i--)
      for (int j = num[v]; j >= 0; j--) {
        tar tmp = dp[u][i] * dp[v][j];
        if (dp[u][i + j] < tmp) dp[u][i + j] = tmp;
      }
    num[u] += num[v];
  }
  for (int i = 1; i <= num[u]; i++) {
    tar tmp(i);
    tmp = tmp * dp[u][i];
    if (dp[u][0] < tmp) dp[u][0] = tmp;
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n - 1; i++) {
    scanf("%d%d", &u, &v);
    add(u, v);
    add(v, u);
  }
  dfs(1, 0);
  dp[1][0].print();
}
