#include <bits/stdc++.h>
using namespace std;
struct E {
  int l, to;
} e[1405];
int n, h[705], l[705], r[705], t, sz[705];
const int M = 1e9;
struct P {
  int l;
  long long a[35];
  P operator*(const P& q) const {
    P c;
    memset(c.a, 0, sizeof(c.a));
    c.l = l + q.l - 1;
    for (int i = 1; i <= l; ++i) {
      for (int o = 1; o <= q.l; ++o) {
        c.a[i + o - 1] += a[i] * q.a[o];
        c.a[i + o] += c.a[i + o - 1] / M;
        c.a[i + o - 1] %= M;
      }
    }
    if (c.a[c.l + 1]) c.l++;
    return c;
  }
  void print() {
    printf("%lld", a[l]);
    for (int i = l - 1; i > 0; i--) printf("%09lld", a[i]);
    putchar('\n');
  }
} d[705][705], ans, g;
P max(P x, P y) {
  if (x.l != y.l) return x.l > y.l ? x : y;
  for (int i = x.l; i; i--) {
    if (x.a[i] != y.a[i]) return x.a[i] > y.a[i] ? x : y;
  }
  return x;
}
void se(int x, int f) {
  l[x] = ++t;
  sz[x] = 1;
  for (int i = h[x]; i; i = e[i].l) {
    if (e[i].to != f) {
      se(e[i].to, x);
      for (int u = sz[x]; u >= 0; --u) {
        for (int o = sz[e[i].to]; o >= 0; --o) {
          d[x][u + o] = max(d[x][u + o], d[e[i].to][o] * d[x][u]);
        }
      }
      sz[x] += sz[e[i].to];
    }
  }
  for (int i = 1; i <= sz[x]; ++i) {
    g.a[1] = i;
    d[x][0] = max(d[x][0], d[x][i] * g);
  }
}
int main() {
  int x, y;
  g.l = 1;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i)
    for (int o = 0; o <= n; ++o) d[i][o].l = d[i][o].a[1] = 1;
  for (int i = 1; i < n; ++i) {
    scanf("%d %d", &x, &y);
    e[i << 1].to = x;
    e[i << 1].l = h[y];
    h[y] = i << 1;
    e[i << 1 | 1].to = y;
    e[i << 1 | 1].l = h[x];
    h[x] = i << 1 | 1;
  }
  se(1, 0);
  d[1][0].print();
}
