#include <bits/stdc++.h>
using namespace std;
const int maxn = 710;
const int maxp = 1000;
static int A[maxn][maxn], lA[maxn], R[maxn];
static int n, x, y, size[maxn];
struct Bigint {
  int A[80], l;
  Bigint(int x = 0) {
    memset(A, 0, sizeof(A));
    l = 1;
    A[1] = x;
  }
  Bigint operator*(const Bigint &x) {
    Bigint C;
    for (int i = 1; i <= l; i++)
      for (int j = 1; j <= x.l; j++) C.A[i + j - 1] += A[i] * x.A[j];
    C.l = l + x.l - 1;
    for (int i = 1; i <= C.l; i++) {
      C.A[i + 1] += C.A[i] / maxp;
      C.A[i] %= maxp;
    }
    if (C.A[C.l + 1] != 0) C.l++;
    return C;
  }
  Bigint operator+(const Bigint &x) {
    Bigint C;
    C.l = max(l, x.l);
    for (int i = 1; i <= C.l; i++) C.A[i] = A[i] + x.A[i];
    for (int i = 1; i <= C.l; i++) {
      C.A[i + 1] += C.A[i] / maxp;
      C.A[i] %= maxp;
    }
    if (C.A[C.l + 1] != 0) C.l++;
    return C;
  }
  bool operator<(const Bigint &x) {
    if (x.l < l) return false;
    if (x.l > l) return true;
    for (int i = l; i >= 0; i--)
      if (A[i] != x.A[i]) return A[i] < x.A[i];
    return true;
  }
  void prt() {
    for (int i = l; i >= 1; i--) {
      if (i == l)
        printf("%d", A[i]);
      else
        printf("%03d", A[i]);
    }
  }
} dp[maxn][maxn];
void dfs(int x, int fa) {
  dp[x][1] = Bigint(1);
  size[x] = 1;
  for (int i = 1; i <= lA[x]; i++)
    if (A[x][i] != fa) {
      int son = A[x][i];
      dfs(son, x);
      for (int i = size[x]; i >= 0; i--)
        for (int j = size[son]; j >= 0; j--)
          if (dp[x][i + j] < dp[x][i] * dp[son][j])
            dp[x][i + j] = dp[x][i] * dp[son][j];
      size[x] += size[son];
    }
  for (int i = 1; i <= size[x]; i++) {
    Bigint C = dp[x][i] * Bigint(i);
    if (dp[x][0] < C) dp[x][0] = C;
  }
  if (size[x] > R[x]) size[x] = R[x];
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    scanf("%d%d", &x, &y);
    A[x][++lA[x]] = y;
    A[y][++lA[y]] = x;
    R[x]++;
    R[y]++;
  }
  dfs(1, 0);
  dp[1][0].prt();
  return 0;
}
