#include <bits/stdc++.h>
using namespace std;
int ts, kk = 1;
template <class T>
inline T _sq(T a) {
  return a * a;
}
template <class T, class X>
inline T _pow(T a, X y) {
  T z = 1;
  for (int i = 1; i <= y; i++) {
    z *= a;
  }
  return z;
}
template <class T>
inline T _gcd(T a, T b) {
  a = _abs(a);
  b = _abs(b);
  if (!b) return a;
  return _gcd(b, a % b);
}
template <class T>
inline T _lcm(T a, T b) {
  a = _abs(a);
  b = _abs(b);
  return (a / _gcd(a, b)) * b;
}
template <class T>
inline T _extended(T a, T b, T &x, T &y) {
  a = _abs(a);
  b = _abs(b);
  T g, x1, y1;
  if (!b) {
    x = 1;
    y = 0;
    g = a;
    return g;
  }
  g = _extended(b, a % b, x1, y1);
  x = y1;
  y = x1 - (a / b) * y1;
  return g;
}
template <class T, class X>
inline bool getbit(T a, X i) {
  T t = 1;
  return ((a & (t << i)) > 0);
}
template <class T, class X>
inline T setbit(T a, X i) {
  T t = 1;
  return (a | (t << i));
}
template <class T, class X>
inline T resetbit(T a, X i) {
  T t = 1;
  return (a & (~(t << i)));
}
template <class T, class X>
inline T togglebit(T a, X i) {
  T t = 1;
  return (a ^ (t << i));
}
template <class T, class X, class Y>
inline T _bigmod(T n, X m, Y mod) {
  unsigned long long ret = 1, a = n % mod;
  while (m) {
    if (m & 1) ret = (ret * a) % mod;
    m >>= 1;
    a = (a * a) % mod;
  }
  ret %= mod;
  return (T)ret;
}
template <class T, class Y>
inline T _modinv(T n, Y mod) {
  return _bigmod(n, mod - 2, mod);
}
const int bit = 10000;
int son[800], x, y, N, c[120];
vector<int> E[800];
struct HugeInt {
  int a[60], len;
  void set(int x) {
    len = 0;
    while (x) a[++len] = x % bit, x /= bit;
  }
  void operator*=(const HugeInt &b) {
    memset(c, 0, sizeof c);
    for (int i = 1; i <= len; i++)
      for (int j = 1; j <= b.len; j++)
        c[i + j - 1] += a[i] * b.a[j], c[i + j] += c[i + j - 1] / bit,
            c[i + j - 1] %= bit;
    len += b.len;
    while (len > 1 && c[len] == 0) len--;
    while (c[len] >= bit) {
      ++len;
      c[len] = c[len - 1] / bit;
      c[len - 1] %= bit;
    }
    for (int i = 1; i <= len; i++) a[i] = c[i];
  }
  void operator*=(int b) {
    for (int i = 1; i <= len; i++) a[i] *= b;
    for (int i = 1; i <= len; i++) a[i + 1] += a[i] / bit, a[i] %= bit;
    len++;
    while (len > 1 && !a[len]) len--;
    while (a[len] >= bit) {
      ++len;
      a[len] = a[len - 1] / bit;
      a[len - 1] %= bit;
    }
  }
  void out() {
    printf("%d", a[len]);
    for (int i = len - 1; i >= 1; i--) printf("%04d", a[i]);
    puts("");
  }
} dp[800][800];
void upd(HugeInt &a, HugeInt b) {
  int flag = 0;
  for (int i = max(a.len, b.len); i >= 1; i--)
    if (b.a[i] > a.a[i]) {
      a = b;
      return;
    } else if (b.a[i] < a.a[i])
      return;
}
void dfs(int u, int fa) {
  dp[u][1].set(1);
  son[u] = 1;
  for (int i = 0; i < E[u].size(); ++i)
    if (E[u][i] != fa) {
      int v = E[u][i];
      dfs(v, u);
      for (int j = son[u]; j >= 0; j--)
        for (int k = son[v]; k >= 0; k--) {
          HugeInt tmp = dp[v][k];
          tmp *= dp[u][j];
          upd(dp[u][j + k], tmp);
        }
      son[u] += son[v];
    }
  for (int i = 0; i <= son[u]; i++) {
    HugeInt tmp = dp[u][i];
    tmp *= i;
    upd(dp[u][0], tmp);
  }
}
int main() {
  scanf("%d", &N);
  for (int i = 1; i <= N - 1; i++)
    scanf("%d%d", &x, &y), E[x].push_back(y), E[y].push_back(x);
  dfs(1, 0);
  dp[1][0].out();
  return 0;
}
