#include <bits/stdc++.h>
using namespace std;
struct BigN {
  int a[30], n;
  void clear(int _n, int _a1) {
    memset(a, 0, sizeof a);
    a[1] = _a1;
    n = _n;
  }
} b, u, f[701][701];
bool operator<(BigN x, BigN y) {
  if (x.n != y.n) return x.n < y.n;
  for (int i = x.n; i >= 1; --i)
    if (x.a[i] != y.a[i]) return x.a[i] < y.a[i];
  return 1;
}
BigN operator*(BigN x, BigN y) {
  b.clear(x.n + y.n - 1, 0);
  if (!x.n || !y.n) {
    b.n = 0;
    return b;
  }
  for (int i = 1; i <= x.n; ++i)
    for (int j = 1; j <= y.n; ++j) b.a[i + j - 1] += x.a[i] * y.a[j];
  for (int i = 1; i <= b.n; ++i) {
    b.a[i + 1] += b.a[i] / (10000);
    b.a[i] %= (10000);
  }
  while (b.a[b.n + 1] > 0) b.n++;
  return b;
}
BigN operator*(BigN x, int y) {
  u.clear(1, y);
  return x * u;
}
int n;
int g[2222], nxt[2222], c[1111], nm;
int s[777], o[777], M;
void addedge(int x, int y) {
  g[nm] = y;
  nxt[nm] = c[x];
  c[x] = nm;
  nm++;
}
void checkmax(BigN& x, BigN y) {
  if (x < y) x = y;
}
int cmp(int x, int y) { return s[x] < s[y]; }
void dfs(int i, int p) {
  s[i] = 1;
  f[i][1].clear(1, 1);
  for (int k = c[i]; ~k; k = nxt[k]) {
    int j = g[k];
    if (j == p) continue;
    dfs(j, i);
  }
  M = 0;
  for (int k = c[i]; ~k; k = nxt[k]) {
    int j = g[k];
    if (j == p) continue;
    o[++M] = j;
  }
  sort(o + 1, o + 1 + M, cmp);
  for (int k = 1; k <= M; k++) {
    int j = o[k];
    if (j == p) continue;
    for (int e1 = s[i]; e1 >= 0; --e1)
      for (int e2 = s[j]; e2 >= 0; --e2)
        checkmax(f[i][e1 + e2], f[i][e1] * f[j][e2]);
    s[i] += s[j];
  }
  for (int e = 1; e <= s[i]; ++e) checkmax(f[i][0], f[i][e] * e);
}
void output(BigN x) {
  printf("%d", x.a[x.n]);
  for (int i = x.n - 1; i >= 1; --i) printf("%04d", x.a[i]);
  puts("");
}
int main() {
  scanf("%d", &n);
  memset(c, -1, sizeof c);
  for (int i = 1; i < n; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    addedge(x, y);
    addedge(y, x);
  }
  dfs(1, -1);
  output(f[1][0]);
}
