#include <bits/stdc++.h>
using namespace std;
struct LongLong {
  short LL[200];
};
LongLong operator*(LongLong a, LongLong b) {
  LongLong c;
  int i, j;
  for (i = 0; i < 200; i++) c.LL[i] = 0;
  for (i = 1; i <= a.LL[0]; i++)
    for (j = 1; j <= b.LL[0]; j++) c.LL[i + j - 1] += a.LL[i] * b.LL[j];
  for (i = 1; i <= a.LL[0] + b.LL[0] + 1; i++)
    if (c.LL[i] > 9) {
      c.LL[i + 1] += c.LL[i] / 10;
      c.LL[i] %= 10;
    }
  c.LL[0] = a.LL[0] + b.LL[0] + 1;
  if (c.LL[0] > 200) puts("overflow!");
  while (c.LL[0] > 0 && c.LL[c.LL[0]] == 0) --c.LL[0];
  return c;
}
LongLong operator*(LongLong a, int b) {
  int i;
  for (i = 1; i <= a.LL[0]; i++) a.LL[i] *= b;
  a.LL[0] += 6;
  for (i = 1; i <= a.LL[0]; i++)
    if (a.LL[i] > 9) {
      a.LL[i + 1] += a.LL[i] / 10;
      a.LL[i] %= 10;
    }
  while (a.LL[0] > 0 && a.LL[a.LL[0]] == 0) --a.LL[0];
  return a;
}
bool operator>(const LongLong& a, const LongLong& b) {
  if (a.LL[0] > b.LL[0]) return true;
  if (a.LL[0] < b.LL[0]) return false;
  for (int i = a.LL[0]; i; i--) {
    if (a.LL[i] > b.LL[i]) return true;
    if (a.LL[i] < b.LL[i]) return false;
  }
  return true;
}
int was[2010], subtree[2010], f[2010], t[2010], p[2010], n, i, j, x, y, ii;
LongLong F[705][705], G[2010], ret;
void MakeEqual(LongLong& a, LongLong b) {
  for (int i = 0; i <= a.LL[0]; i++) a.LL[i] = b.LL[i];
}
void dfs(int k) {
  was[k] = 1;
  vector<int> sons;
  sons.clear();
  subtree[k] = 1;
  int q = f[k];
  while (q) {
    if (!was[t[q]]) {
      dfs(t[q]);
      sons.push_back(t[q]);
      subtree[k] += subtree[t[q]];
    }
    q = p[q];
  }
  F[k][1].LL[0] = F[k][1].LL[1] = 1;
  int hang = 1, i, j, cc;
  for (i = 0; i < sons.size(); i++) {
    for (j = 0; j <= hang + subtree[sons[i]]; j++) MakeEqual(G[j], F[k][j]);
    for (cc = 1; cc <= hang; cc++)
      for (j = 0; j <= subtree[sons[i]]; j++)
        if (F[k][cc] * F[sons[i]][j] > G[cc + j])
          G[cc + j] = F[k][cc] * F[sons[i]][j];
    hang += subtree[sons[i]];
    for (j = 0; j <= hang; j++) F[k][j] = G[j];
  }
  for (i = 1; i <= hang; i++)
    if (F[k][i] * i > F[k][0]) F[k][0] = F[k][i] * i;
}
void addedge(int x, int y) {
  t[++ii] = y;
  p[ii] = f[x];
  f[x] = ii;
}
int main(int argc, char* const argv[]) {
  scanf("%d", &n);
  for (i = 1; i < n; i++) {
    scanf("%d%d", &x, &y);
    addedge(x, y);
    addedge(y, x);
  }
  dfs(1);
  ret = F[1][0];
  for (i = 1; i <= n; i++)
    if (F[1][i] * i > ret) ret = F[1][i] * i;
  for (i = ret.LL[0]; i; i--) putchar('0' + ret.LL[i]);
  puts("");
  return 0;
}
