#include <bits/stdc++.h>
const int N = 705;
int n, x, y, cnt;
int head[N], sz[N];
short dp[N][N][120];
struct node {
  int u, v;
} edge[N << 1];
void add(int x, int y) {
  edge[cnt] = (node){head[x], y}, head[x] = cnt++;
  edge[cnt] = (node){head[y], x}, head[y] = cnt++;
}
int A[200], B[200], C[200];
void dfs(int x, int fa) {
  sz[x] = dp[x][0][1] = dp[x][0][0] = dp[x][1][0] = dp[x][1][1] = 1;
  int i, j, k, p, q;
  for (i = head[x]; ~i; i = edge[i].u) {
    int y = edge[i].v;
    if (y == fa) continue;
    dfs(y, x), sz[x] += sz[y];
    for (j = sz[x]; j >= 0; --j)
      for (k = std::min(sz[x] - sz[y], j); k >= std::max(j - sz[y], 1); --k) {
        int lena = dp[x][k][0], lenb = dp[y][j - k][0];
        for (p = 1; p <= lena; ++p) A[p] = dp[x][k][p];
        for (p = 1; p <= lenb; ++p) B[p] = dp[y][j - k][p];
        memset(C, 0, sizeof C);
        for (p = 1; p <= lena; ++p)
          for (q = 1; q <= lenb; ++q)
            C[p + q - 1] += A[p] * B[q], C[p + q] += C[p + q - 1] / 10,
                C[p + q - 1] %= 10;
        int lenc = lena + lenb;
        while (C[lenc] == 0 && lenc != 1) --lenc;
        if (lenc > dp[x][j][0]) {
          dp[x][j][0] = lenc;
          for (p = 1; p <= lenc; ++p) dp[x][j][p] = C[p];
        } else if (lenc < dp[x][j][0])
          continue;
        else {
          int flag = 1;
          for (p = lenc; p; --p)
            if (C[p] != dp[x][j][p]) {
              if (C[p] > dp[x][j][p]) flag = 0;
              break;
            }
          if (!flag)
            for (p = 1; p <= lenc; ++p) dp[x][j][p] = C[p];
        }
      }
  }
  for (i = 1; i <= sz[x]; ++i) {
    int len = dp[x][i][0];
    memset(A, 0, sizeof A);
    for (j = 1; j <= len; ++j) A[j] = dp[x][i][j];
    for (j = 1; j <= len; ++j) A[j] = A[j] * i;
    for (j = 1; j <= len; ++j) A[j + 1] += A[j] / 10, A[j] %= 10;
    if (A[len + 1]) ++len;
    while (A[len] >= 10) A[len + 1] = A[len] / 10, A[len] %= 10, ++len;
    if (len > dp[x][0][0]) {
      dp[x][0][0] = len;
      for (j = 1; j <= len; ++j) dp[x][0][j] = A[j];
    } else if (len < dp[x][0][0])
      continue;
    else {
      int flag = 1;
      for (j = len; j; --j)
        if (A[j] != dp[x][0][j]) {
          if (A[j] > dp[x][0][j]) flag = 0;
          break;
        }
      if (!flag)
        for (j = 1; j <= len; ++j) dp[x][0][j] = A[j];
    }
  }
}
int main() {
  std::cin >> n;
  memset(head, -1, sizeof head);
  int i;
  for (i = 1; i < n; ++i) std::cin >> x >> y, add(x, y);
  dfs(1, 0);
  for (i = dp[1][0][0]; i; --i) std::cout << dp[1][0][i];
  puts("");
}
