#include <bits/stdc++.h>
using namespace std;
template <class T>
struct rge {
  T b, e;
};
template <class T>
rge<T> range(T i, T j) {
  return rge<T>{i, j};
}
template <class T>
auto dud(T *x) -> decltype(cerr << *x, 0);
template <class T>
char dud(...);
struct debug {
  template <class T>
  debug &operator<<(const T &) {
    return *this;
  }
};
const int N = 705;
const int base = 1e9;
vector<long long> toBig(long long x) {
  if (x == 0) return {0};
  vector<long long> a;
  for (; x > 0; x /= base) a.emplace_back(x % base);
  return a;
}
vector<long long> operator+(vector<long long> a, vector<long long> b) {
  vector<long long> c(max((int)a.size(), (int)b.size()) + 1, 0);
  for (auto i = (0) - ((0) > ((int)c.size()));
       i != (int)c.size() - ((0) > ((int)c.size()));
       i += 1 - 2 * ((0) > ((int)c.size()))) {
    c[i] = (i < (int)a.size() ? a[i] : 0) + (i < (int)b.size() ? b[i] : 0);
    c[i + 1] += c[i] / base;
    c[i] %= base;
  }
  if (!c.back()) c.pop_back();
  return c;
}
vector<long long> operator*(vector<long long> a, vector<long long> b) {
  vector<long long> c((int)a.size() + (int)b.size(), 0);
  for (auto i = (0) - ((0) > ((int)a.size()));
       i != (int)a.size() - ((0) > ((int)a.size()));
       i += 1 - 2 * ((0) > ((int)a.size())))
    for (auto j = (0) - ((0) > ((int)b.size()));
         j != (int)b.size() - ((0) > ((int)b.size()));
         j += 1 - 2 * ((0) > ((int)b.size()))) {
      c[i + j] += a[i] * b[j];
      c[i + j + 1] += c[i + j] / base;
      c[i + j] %= base;
    }
  if (!c.back()) c.pop_back();
  return c;
}
ostream &operator<<(ostream &os, vector<long long> &b) {
  for (auto i = ((int)b.size()) - (((int)b.size()) > (0));
       i != 0 - (((int)b.size()) > (0)); i += 1 - 2 * (((int)b.size()) > (0))) {
    string d = to_string(b[i]);
    while (i < (int)b.size() - 1 && (int)d.size() < 9) d = "0" + d;
    os << d;
  }
  return os;
}
bool bigger(const vector<long long> &a, const vector<long long> &b) {
  debug() << "used";
  if ((int)a.size() != (int)b.size()) return (int)a.size() > (int)b.size();
  for (auto i = ((int)a.size()) - (((int)a.size()) > (0));
       i != 0 - (((int)a.size()) > (0)); i += 1 - 2 * (((int)a.size()) > (0)))
    if (a[i] != b[i]) return a[i] > b[i];
  return 0;
}
vector<int> graph[N];
vector<long long> dp[N][N];
int tot[N];
int n;
template <class T>
void umax(T &a, T b) {
  if (bigger(b, a)) a = b;
}
void dfs(int u, int pr = 0) {
  tot[u] = 1;
  dp[u][0] = toBig(0);
  dp[u][1] = toBig(1);
  for (int v : graph[u])
    if (v != pr) {
      dfs(v, u);
      for (auto x = (tot[u] + 1) - ((tot[u] + 1) > (0));
           x != 0 - ((tot[u] + 1) > (0)); x += 1 - 2 * ((tot[u] + 1) > (0)))
        for (auto y = (tot[v] + 1) - ((tot[v] + 1) > (0));
             y != 0 - ((tot[v] + 1) > (0)); y += 1 - 2 * ((tot[v] + 1) > (0)))
          umax(dp[u][x + y], dp[u][x] * dp[v][y]);
      tot[u] += tot[v];
    }
  for (auto x = (1) - ((1) > (tot[u] + 1));
       x != tot[u] + 1 - ((1) > (tot[u] + 1));
       x += 1 - 2 * ((1) > (tot[u] + 1)))
    umax(dp[u][0], dp[u][x] * toBig(x));
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  for (auto i = (0) - ((0) > (n - 1)); i != n - 1 - ((0) > (n - 1));
       i += 1 - 2 * ((0) > (n - 1))) {
    int u, v;
    cin >> u >> v;
    graph[u].push_back(v);
    graph[v].push_back(u);
  }
  for (auto u = (0) - ((0) > (n + 1)); u != n + 1 - ((0) > (n + 1));
       u += 1 - 2 * ((0) > (n + 1)))
    for (auto x = (0) - ((0) > (n + 1)); x != n + 1 - ((0) > (n + 1));
         x += 1 - 2 * ((0) > (n + 1)))
      dp[u][x] = toBig(1);
  vector<long long> a = toBig(11111111111111111);
  vector<long long> b = toBig(9999999999999);
  umax(a, b);
  debug() << " "
          << "a"
             ": "
          << (a) << " ";
  dfs(1);
  cout << dp[1][0] << '\n';
  return 0;
}
