#include <bits/stdc++.h>
using namespace std;
int const LBS = 8, BS = (int)pow(10., LBS);
inline void numcpy(int *b, int *a) {
  if (b != a) memmove(b, a, (a[0] + 1) * sizeof(a[0]));
}
inline void put(int *a, FILE *f = stdout) {
  int const N = 1 << 10;
  char b[N * LBS];
  fprintf(f, "%d", a[a[0]]);
  for (int i = a[0] - 1; i > 0; i -= N) {
    for (int k = 0; k < N && k < i; k++)
      for (int j = LBS - 1, x = a[i - k]; j >= 0; --j, x /= 10)
        b[k * LBS + j] = char(x % 10) + '0';
    fwrite(b, LBS, min(N, i), f);
  }
}
inline int cmp(int *a, int *b) {
  if (a[0] != b[0]) return a[0] < b[0] ? -1 : 1;
  for (int i = a[0]; i; --i)
    if (a[i] != b[i]) return a[i] < b[i] ? -1 : 1;
  return 0;
}
inline void mul(int *c, int *a, int b) {
  if (!b) {
    c[0] = 0;
    return;
  }
  long long d, x = 0;
  for (int i = 1; i <= a[0]; i++) {
    d = (long long)a[i] * b + x;
    x = d / BS, c[i] = int(d - x * BS);
  }
  x ? c[c[0] = a[0] + 1] = (int)x : c[0] = a[0];
}
inline void mullong(int *c, int *a, int *b) {
  if (a[0] <= 1 || b[0] <= 1) {
    if (!a[0] || !b[0])
      c[0] = 0;
    else if (a[0] == 1)
      mul(c, b, a[1]);
    else
      mul(c, a, b[1]);
    return;
  }
  long long *d = new long long[a[0] + b[0]], e;
  memset(d, 0, (a[0] + b[0]) * sizeof(long long));
  const int NIT = 920;
  int k = NIT;
  for (int i = 1; i <= a[0]; i++) {
    for (int j = 1; j <= b[0]; ++j) d[i + j - 2] += (long long)a[i] * b[j];
    if (i == k) {
      for (int j = i; j < i + b[0]; ++j) {
        e = d[j - 1] / BS;
        d[j] += e;
        d[j - 1] -= e * BS;
      }
      k += NIT;
    }
  }
  c[0] = a[0] + b[0];
  for (int i = 1; i < c[0]; i++) {
    e = d[i - 1] / BS;
    d[i] += e;
    c[i] = int(d[i - 1] - e * BS);
  }
  d[c[0] - 1] ? c[c[0]] = int(d[c[0] - 1]) : --c[0];
  delete[] d;
}
using namespace std;
int const N = 705, K = 20;
int n;
int pr[N], nv[N], v[N], g[N][N];
int a[N][N][K], cr[N][K], r[K];
void dfs(int x) {
  nv[x] = 1;
  for (int i = 0; i < v[x]; i++)
    if (g[x][i] != pr[x]) {
      pr[g[x][i]] = x;
      dfs(g[x][i]);
      memcpy(cr, a[x], sizeof cr);
      for (int j = 0; j <= nv[x]; j++)
        for (int k = 0; k <= nv[g[x][i]]; k++) {
          mullong(r, cr[j], a[g[x][i]][k]);
          if (cmp(a[x][j + k], r) < 0) numcpy(a[x][j + k], r);
        }
      nv[x] += nv[g[x][i]];
    }
  for (int i = 0; i < nv[x]; i++) {
    mul(r, a[x][i], nv[x] - i);
    if (cmp(a[x][nv[x]], r) < 0) numcpy(a[x][nv[x]], r);
  }
  x = x;
}
int main() {
  for (int i = 0; i < N; i++) {
    pr[i] = 0;
    for (int j = 0; j < N; j++) a[i][j][0] = a[i][j][1] = 1;
  }
  cin >> n;
  for (int i = 1; i < n; i++) {
    int a, b;
    cin >> a >> b;
    g[a][v[a]++] = b;
    g[b][v[b]++] = a;
  }
  dfs(1);
  int res[K] = {1, 1};
  for (int i = 0; i <= n; i++)
    if (cmp(res, a[1][i]) < 0) numcpy(res, a[1][i]);
  put(res);
  return 0;
}
