#include <bits/stdc++.h>
using namespace std;
const int maxn = 710;
int n;
struct Tbig {
  static const int bit = 10000;
  int n, a[30];
  Tbig(int x = 0) {
    memset(a, 0, sizeof a);
    for (n = 0; x; x /= bit) a[n++] = x % bit;
    !n ? n = 1 : 0;
  }
  Tbig operator*(const Tbig &b) const {
    int i, j;
    Tbig c;
    c.n = n + b.n;
    for (i = 0; i < n; ++i)
      for (j = 0; j < b.n; ++j) {
        c.a[i + j] += a[i] * b.a[j];
        c.a[i + j + 1] += c.a[i + j] / bit, c.a[i + j] %= bit;
      }
    for (; c.n > 0 && !c.a[c.n]; --c.n)
      ;
    ++c.n;
    return c;
  }
  bool operator<(const Tbig &b) const {
    int i;
    if (n != b.n) return n < b.n;
    for (i = n - 1; i >= 0; --i)
      if (a[i] != b.a[i]) return a[i] < b.a[i];
    return false;
  }
  void print() {
    int i;
    printf("%d", a[n - 1]);
    for (i = n - 2; i >= 0; --i) printf("%04d", a[i]);
    printf("\n");
  }
};
struct Talt {
  int tot;
  struct Tsqy {
    int s;
    Tsqy *l;
    inline void set(Tsqy *_l, int _s) { l = _l, s = _s; }
  } * pos[maxn], buf[maxn * 2];
  inline void add(int a, int b) {
    buf[++tot].set(pos[a], b), pos[a] = buf + tot;
    buf[++tot].set(pos[b], a), pos[b] = buf + tot;
  }
} alt;
namespace Ninit {
void init() {
  int i, a1, a2;
  scanf("%d", &n);
  for (i = 1; i < n; ++i) {
    scanf("%d%d", &a1, &a2), alt.add(a1, a2);
  }
}
}  // namespace Ninit
namespace Nsolve {
Tbig F[maxn][maxn], G[maxn], F_xi;
int S[maxn];
void dfs(int x, int f) {
  Talt::Tsqy *p;
  int i, j;
  S[x] = 1, F[x][1] = 1;
  for (p = alt.pos[x]; p; p = p->l)
    if (p->s != f) {
      dfs(p->s, x), S[x] += S[p->s];
      for (i = S[x]; i >= 1; --i) {
        F_xi = F[x][i];
        for (j = min(S[p->s], i - 1); j > 0 && i - j <= S[x] - S[p->s]; --j)
          F[x][i] = max(F[x][i], F[x][i - j] * F[p->s][j]);
        F[x][i] = max(F[x][i], F_xi * G[p->s]);
      }
    }
  for (i = 1; i <= S[x]; ++i) G[x] = max(G[x], F[x][i] * i);
}
void solve() {
  dfs(1, 0);
  G[1].print();
}
}  // namespace Nsolve
int main() {
  Ninit::init();
  Nsolve::solve();
  return 0;
}
