#include <bits/stdc++.h>
using namespace std;
char __buf[1 << 20], *__p1, *__p2;
int read() {
  int s = 0, w = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    s = (s << 3) + (s << 1) + (ch ^ 48), ch = getchar();
  return s * w;
}
const int maxn = 710;
struct Wint : vector<long long> {
  const static long long BIT = 1e8;
  Wint(long long n = 0) {
    push_back(n);
    check();
  }
  Wint& operator=(const char* num) {
    int Len = strlen(num) - 1;
    clear();
    for (int i = Len; i >= 0; i -= 9) {
      push_back(0);
      long long w = 1;
      for (int j = i; j > i - 9 && j >= 0; --j)
        back() += (num[j] ^ 48) * w, w *= 10;
    }
    return *this;
  }
  Wint& check() {
    while (!empty() && !back()) pop_back();
    if (empty()) return *this;
    for (int i = 1; i < size(); ++i)
      (*this)[i] += (*this)[i - 1] / BIT, (*this)[i - 1] %= BIT;
    while (back() >= BIT) {
      push_back(back() / BIT);
      (*this)[size() - 2] %= BIT;
    }
    return *this;
  }
};
bool operator<(Wint a, Wint b) {
  if (a.size() != b.size()) return a.size() < b.size();
  for (int i = a.size() - 1; i >= 0; --i)
    if (a[i] != b[i]) return a[i] < b[i];
  return 0;
}
bool operator>(Wint a, Wint b) { return b < a; }
bool operator<=(Wint a, Wint b) { return !(a > b); }
bool operator>=(Wint a, Wint b) { return !(a < b); }
bool operator!=(Wint a, Wint b) { return a < b || b < a; }
bool operator==(Wint a, Wint b) { return !(a < b) && !(b < a); }
Wint& operator+=(Wint& a, Wint b) {
  if (a.size() < b.size()) a.resize(b.size());
  for (int i = 0; i < b.size(); ++i) a[i] += b[i];
  return a.check();
}
Wint operator+(Wint a, Wint b) { return a += b; }
Wint& operator-=(Wint& a, Wint b) {
  for (int i = 0; i < b.size(); a[i] -= b[i], ++i)
    if (a[i] < b[i]) {
      int j = i + 1;
      while (!a[j]) ++j;
      while (j > i) --a[j], a[--j] += Wint::BIT;
    }
  return a.check();
}
Wint operator-(Wint a, Wint b) { return a -= b; }
Wint operator*(Wint a, Wint b) {
  Wint n;
  n.assign(a.size() + b.size() - 1, 0);
  for (int i = 0; i < a.size(); ++i)
    for (int j = 0; j < b.size(); ++j) n[i + j] += a[i] * b[j];
  return n.check();
}
Wint& operator*=(Wint& a, Wint b) { return a = a * b; }
Wint operator/(Wint a, int b) {
  Wint n;
  bool wp = 0;
  long long t = 0;
  for (int i = a.size() - 1; i >= 0; --i) {
    t = t * Wint::BIT + a[i];
    if (wp || t / b) wp = 1, n.push_back(t / b);
    t %= b;
  }
  reverse(n.begin(), n.end());
  return n;
}
Wint& operator/=(Wint& a, int b) { return a = a / b; }
void writeX(Wint n) {
  if (n.empty()) return putchar('0'), void();
  int Len = n.size() - 1;
  printf("%lld", n[Len]);
  for (int i = Len - 1; i >= 0; --i) printf("%08lld", n[i]);
}
Wint Win(long long num) {
  Wint t = num;
  return t;
}
vector<int> G[maxn];
Wint f[maxn][maxn], t[maxn];
int n, sz[maxn];
void add(int x, int y) { G[x].push_back(y), G[y].push_back(x); }
template <class T>
void Max(T& x, T y) {
  x = max(x, y);
}
void dfs(int x, int pa) {
  f[x][1] = Win(1), sz[x] = 1;
  for (int y : G[x])
    if (y ^ pa) {
      dfs(y, x);
      for (int i = 1; i <= sz[x]; i++) {
        for (int j = 1; j <= sz[y]; j++)
          Max(t[i], f[x][i] * f[y][j] * Win(j)),
              Max(t[i + j], f[x][i] * f[y][j]);
      }
      for (int i = 1; i <= sz[x] + sz[y]; i++) f[x][i] = t[i], t[i] = Win(0);
      sz[x] += sz[y];
    }
}
signed main() {
  n = read();
  for (int i = 1; i < n; i++) add(read(), read());
  dfs(1, 0);
  Wint ans = Win(0);
  for (int i = 1; i <= n; i++) ans = max(ans, f[1][i] * Win(i));
  writeX(ans);
  return 0;
}
