#include <bits/stdc++.h>
using namespace std;
int n, size[10001];
vector<int> G[10001];
struct Bigint {
  int len, num[51];
  Bigint() {
    memset(num, 0, sizeof(num));
    len = 1;
  }
};
Bigint dp[701][701];
Bigint operator*(Bigint A, Bigint B) {
  Bigint C;
  for (int i = 1; i <= A.len; i++) {
    for (int j = 1; j <= B.len; j++) {
      C.num[i + j - 1] += A.num[i] * B.num[j];
      C.num[i + j] += C.num[i + j - 1] / 10000;
      C.num[i + j - 1] %= 10000;
    }
  }
  C.len = A.len + B.len;
  if (C.num[C.len] == 0) C.len--;
  return C;
}
Bigint Max(Bigint A, Bigint B) {
  if (A.len != B.len) return A.len > B.len ? A : B;
  for (int i = A.len; i >= 1; i--) {
    if (A.num[i] != B.num[i]) return A.num[i] > B.num[i] ? A : B;
  }
  return A;
}
void Printf(Bigint A) {
  printf("%d", A.num[A.len]);
  for (int i = A.len - 1; i >= 1; i--) {
    printf("%04d", A.num[i]);
  }
}
void DFS(int x, int fa) {
  size[x] = 1, dp[x][1].len = dp[x][1].num[1] = 1;
  for (int i = 0; i < G[x].size(); i++) {
    int t = G[x][i];
    if (t == fa) continue;
    DFS(t, x);
    for (int j = size[x]; j >= 0; j--) {
      for (int k = size[t]; k >= 0; k--) {
        dp[x][j + k] = Max(dp[x][j + k], dp[x][j] * dp[t][k]);
      }
    }
    size[x] += size[t];
  }
  for (int i = 1; i <= size[x]; i++) {
    Bigint c;
    c.len = 1, c.num[1] = i;
    dp[x][0] = Max(c * dp[x][i], dp[x][0]);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n - 1; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    G[a].push_back(b);
    G[b].push_back(a);
  }
  DFS(1, 0);
  Printf(dp[1][0]);
  return 0;
}
