#include <bits/stdc++.h>
using namespace std;
struct large {
  vector<int> d;
  large(int x = 0) { d.clear(), d.push_back(x), relax(); }
  void relax() {
    while (d.size() > 1 && !d.back()) d.pop_back();
    for (int i = 0, rem = 0; i + 1 < d.size(); i++) {
      d[i + 1] += d[i] / 10;
      d[i] %= 10;
    }
    while (d.back() >= 10) {
      d.push_back(d.back() / 10);
      d[d.size() - 2] %= 10;
    }
  }
  friend large max(large x, large y) { return x < y ? y : x; }
  large operator*(large t) {
    large r;
    r.d.resize(d.size() + t.d.size() + 5);
    for (int i = 0; i < d.size(); i++)
      for (int j = 0; j < t.d.size(); j++) r.d[i + j] += d[i] * t.d[j];
    r.relax();
    return r;
  }
  large& operator*=(large t) { return *this = *this * t; }
  large& operator=(large t) {
    d = t.d;
    return *this;
  }
  bool operator<(large t) {
    if (d.size() != t.d.size()) return d.size() < t.d.size();
    for (int i = (int)d.size() - 1; ~i; i--)
      if (d[i] < t.d[i])
        return true;
      else if (d[i] > t.d[i])
        return false;
    return false;
  }
};
const int maxn = 705;
int n;
large dp[maxn], ndp[maxn][maxn], pd[maxn];
vector<int> adj[maxn];
void dfs(int u = 0, int par = -1) {
  sort(adj[u].begin(), adj[u].end());
  auto it = lower_bound(adj[u].begin(), adj[u].end(), par);
  if (it != adj[u].end() && *it == par) adj[u].erase(it);
  pd[u] = 1;
  for (int v : adj[u]) dfs(v, u), pd[u] *= dp[v];
  dp[u] = pd[u];
  int sz = adj[u].size();
  ndp[u][0] = 1;
  for (int i = 0; i < sz; i++) {
    int v = adj[u][i];
    for (int j = sz; j > 0; j--)
      ndp[u][j] = max(ndp[u][j] * dp[v], ndp[u][j - 1] * pd[v]);
    ndp[u][0] *= dp[v];
  }
  for (int i = 0; i <= adj[u].size(); i++)
    dp[u] = max(dp[u], ndp[u][i] * (1 + i));
  vector<large> ps;
  for (int v : adj[u]) ps.push_back(ps.empty() ? dp[v] : dp[v] * ps.back());
  large cur = 1;
  for (int i = (int)adj[u].size() - 1; ~i; i--) {
    int v = adj[u][i];
    for (int j = 0; j <= adj[v].size(); j++)
      dp[u] = max(dp[u], (i ? ps[i - 1] : 1) * cur * ndp[v][j] * (j + 2));
    cur *= dp[v];
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 0, u, v; i < n - 1; i++) {
    scanf("%d%d", &u, &v);
    --u, --v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  dfs();
  reverse(dp[0].d.begin(), dp[0].d.end());
  for (int u : dp[0].d) printf("%d", u);
  return 0;
}
