#include <bits/stdc++.h>
using namespace std;
int n, sz[702];
vector<int> s[702];
struct Big {
  int num[30], l;
  void Init() {
    l = 1;
    memset(num, 0, sizeof(num));
    num[1] = 1;
  }
  Big operator*(const Big &_) const {
    Big res;
    res.Init();
    res.num[1] = 0;
    res.l = l + _.l - 1;
    for (int i = 1; i <= l; i++)
      for (int j = 1; j <= _.l; j++) res.num[i + j - 1] += num[i] * _.num[j];
    for (int i = 1; i <= res.l; i++)
      res.num[i + 1] += res.num[i] / 10000, res.num[i] %= 10000;
    if (res.num[res.l + 1]) res.l++;
    return res;
  }
  Big operator*(const int &_) const {
    Big res;
    res.Init();
    res.num[1] = 0;
    res.l = l;
    for (int i = 1; i <= l; i++) res.num[i] = num[i] * _;
    for (int i = 1; i <= l; i++)
      res.num[i + 1] += res.num[i] / 10000, res.num[i] %= 10000;
    if (res.num[res.l + 1]) res.l++;
    return res;
  }
} dp[702][702];
void Print(Big a) {
  if (!a.l) {
    printf("0\n");
    return;
  }
  printf("%d", a.num[a.l]);
  for (int i = a.l - 1; i; i--) printf("%04d", a.num[i]);
}
Big Max(Big a, Big b) {
  if (a.l < b.l) return b;
  if (a.l > b.l) return a;
  for (int i = a.l; i >= 1; i--) {
    if (a.num[i] > b.num[i]) return a;
    if (a.num[i] < b.num[i]) return b;
  }
  return a;
}
void dfs(int x, int f) {
  sz[x] = 1;
  for (int i = 0; i < (int)s[x].size(); i++) {
    int to = s[x][i];
    if (to == f) continue;
    dfs(to, x);
    for (int j = sz[x]; j >= 0; j--)
      for (int k = sz[to]; k >= 0; k--)
        dp[x][j + k] = Max(dp[x][j + k], dp[x][j] * dp[to][k]);
    sz[x] += sz[to];
  }
  for (int i = 1; i <= sz[x]; i++) {
    dp[x][0] = Max(dp[x][0], dp[x][i] * i);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) dp[i][j].Init();
  for (int i = 1, u, v; i < n; i++) {
    scanf("%d%d", &u, &v);
    s[u].push_back(v);
    s[v].push_back(u);
  }
  dfs(1, 0);
  Print(dp[1][0]);
  return 0;
}
