#include <bits/stdc++.h>
using namespace std;
const int N = 711, M = 1000;
int n, m;
vector<int> e[N];
struct bint {
  vector<uint32_t> a;
  bint() { a.push_back(0); }
  bint(int x) { a.push_back(x); }
  bint operator+(int x) const {
    int j = 0;
    int l = a.size();
    bint z = *this;
    for (int i = 0; i < l; ++i) {
      int t = j + a[i] + x;
      z.a[i] = t % M;
      j = t / M;
    }
    if (j) z.a.push_back(j);
    return z;
  }
  bint operator*(int x) const {
    int j = 0;
    int l = a.size();
    bint z = *this;
    for (int i = 0; i < l; ++i) {
      int t = j + a[i] * x;
      z.a[i] = t % M;
      j = t / M;
    }
    if (j) z.a.push_back(j);
    return z;
  }
  bint operator*(const bint &b) const {
    bint z;
    int la = a.size(), lb = b.a.size();
    if (*this < bint(1) || b < bint(1)) return bint(0);
    z.a.resize(la + lb - 1, 0);
    for (int i = 0; i < la; ++i)
      for (int j = 0; j < lb; ++j) z.a[i + j] += a[i] * b.a[j];
    int j = 0;
    for (int i = 0; i < la + lb - 1; ++i) {
      int t = j + z.a[i];
      z.a[i] = t % M;
      j = t / M;
    }
    if (j) z.a.push_back(j);
    return z;
  }
  bool operator<(const bint &b) const {
    if (a.size() != b.a.size()) return a.size() < b.a.size();
    int l = a.size();
    for (int i = l - 1; i >= 0; --i) {
      if (a[i] != b.a[i]) return a[i] < b.a[i];
    }
    return false;
  }
  friend ostream &operator<<(ostream &f, const bint &b) {
    int l = b.a.size();
    f << b.a.back();
    for (int i = l - 2; i >= 0; --i) {
      f << b.a[i] / 100 % 10 << b.a[i] / 10 % 10 << b.a[i] % 10;
    }
    return f;
  }
};
bint f[N][N];
int s[N];
void dfs(int v, int fa) {
  f[v][1] = bint(1);
  s[v] = 1;
  vector<bint> g(n + 1);
  for (int i : e[v])
    if (i != fa) {
      dfs(i, v);
      for (int k = 1; k <= s[v] + s[i]; ++k) g[k] = f[v][k];
      for (int k = 1; k <= s[v]; ++k) {
        for (int j = 1; j <= s[i]; ++j) {
          g[k + j] = max(g[k + j], f[v][k] * f[i][j]);
          g[k] = max(g[k], f[v][k] * f[i][j] * j);
        }
      }
      s[v] += s[i];
      for (int k = 1; k <= s[v]; ++k) f[v][k] = g[k];
    }
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n - 1; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    --x, --y;
    e[x].push_back(y);
    e[y].push_back(x);
  }
  dfs(0, -1);
  bint ans;
  for (int i = 1; i <= n; ++i) {
    ans = max(ans, f[0][i] * i);
  }
  cout << ans << endl;
  return 0;
}
