#include <bits/stdc++.h>
using namespace std;
const int N = 1e3;
struct BigInt {
  vector<int> s;
  BigInt(int num = 0) { *this = num; }
  BigInt operator=(int num) {
    s.clear();
    do {
      s.push_back(num % 10);
      num /= 10;
    } while (num);
    return *this;
  }
  const BigInt operator*(const BigInt& b) const {
    BigInt res;
    res.s.resize(s.size() + b.s.size());
    for (int i = 0; i < s.size(); i++)
      for (int j = 0; j < b.s.size(); j++) {
        res.s[i + j] += s[i] * b.s[j];
        res.s[i + j + 1] += res.s[i + j] / 10;
        res.s[i + j] %= 10;
      }
    while (res.s.size() > 1 && res.s[res.s.size() - 1] == 0) res.s.pop_back();
    return res;
  }
  bool operator<(const BigInt& b) const {
    if (s.size() != b.s.size()) return s.size() < b.s.size();
    for (int i = s.size() - 1; i >= 0; i--)
      if (s[i] != b.s[i]) return s[i] < b.s[i];
  }
} f[N][N];
namespace FastIO {
inline int read() {
  int x = 0, F = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') F = ch == '-' ? -1 : 1, ch = getchar();
  while (ch >= '0' && ch <= '9')
    x = (x << 1) + (x << 3) + (ch & 15), ch = getchar();
  return x * F;
}
inline void write(BigInt x) {
  for (int i = x.s.size() - 1; i >= 0; i--) putchar(x.s[i] | 48);
}
}  // namespace FastIO
using namespace FastIO;
int n, sz[N];
struct Graph {
  int tot, to[N << 1];
  int head[N << 1], nxt[N << 1];
  inline void connect(int u, int v) {
    to[++tot] = v;
    nxt[tot] = head[u];
    head[u] = tot;
  }
} G;
void Dfs(int u, int fa) {
  f[u][1] = BigInt(1), sz[u] = 1;
  for (int i = G.head[u]; i; i = G.nxt[i]) {
    int v = G.to[i];
    if (v == fa) continue;
    Dfs(v, u);
    for (int j = sz[u]; j >= 1; j--)
      for (int k = sz[v]; k >= 0; k--)
        f[u][j + k] = max(f[u][j + k], f[u][j] * f[v][k]);
    sz[u] += sz[v];
  }
  f[u][0] = BigInt(sz[u]);
  for (int i = 1; i <= sz[u]; i++) f[u][0] = max(f[u][0], f[u][i] * i);
}
signed main() {
  cin >> n;
  for (int i = 1; i < n; i++) {
    int u = read(), v = read();
    G.connect(u, v);
    G.connect(v, u);
  }
  Dfs(1, 0), write(f[1][0]);
  return 0;
}
