#include <bits/stdc++.h>
using namespace std;
const int maxl = 60, w = 10000;
struct Big {
  int s[maxl], l;
  Big() {
    memset(s, 0, sizeof(s));
    l = 1;
  }
  inline void fix() {
    for (int i = 1; i < l; i++) {
      if (s[i] >= w) {
        s[i + 1] += s[i] / w;
        s[i] %= w;
      }
    }
    while (s[l] >= w) {
      s[l + 1] += s[l] / w;
      s[l] %= w;
      l++;
    }
  }
  void fuzhi(int x) {
    s[1] = x;
    l = 1;
    fix();
  }
  inline void out() {
    if (s[l] >= 1000) cout << s[l] / 1000 % 10;
    if (s[l] >= 100) cout << s[l] / 100 % 10;
    if (s[l] >= 10) cout << s[l] / 10 % 10;
    cout << s[l] % 10;
    for (int i = l - 1; i >= 1; i--) {
      if (s[i] < 1000) cout << 0;
      if (s[i] < 100) cout << 0;
      if (s[i] < 10) cout << 0;
      cout << s[i];
    }
    cout << endl;
  }
};
inline Big operator*(const Big &x, const Big &y) {
  Big ans;
  ans.l = x.l + y.l - 1;
  for (int i = 1; i <= x.l; i++) {
    for (int j = 1; j <= y.l; j++) ans.s[i + j - 1] += x.s[i] * y.s[j];
  }
  ans.fix();
  return ans;
}
inline bool operator<(const Big &x, const Big &y) {
  if (x.l != y.l) return x.l < y.l;
  for (int i = x.l; i >= 1; i--)
    if (x.s[i] != y.s[i]) return x.s[i] < y.s[i];
  return false;
}
inline Big tran(long long x) {
  Big ans;
  ans.fuzhi(x);
  return ans;
}
const int maxn = 770;
struct E {
  int from, to, next;
} e[maxn * 2];
int te = 1, n, point[maxn];
void add(int x, int y) {
  te++;
  e[te].from = x;
  e[te].to = y;
  e[te].next = point[x];
  point[x] = te;
}
int size[maxn];
Big f[maxn][maxn];
void dfs(int p, int fa) {
  size[p] = 1;
  for (int i = 0; i <= n; i++) f[p][i].fuzhi(1);
  for (int i = point[p]; i; i = e[i].next) {
    int to = e[i].to;
    if (to == fa) continue;
    dfs(to, p);
    for (int j = size[p]; j >= 0; j--)
      for (int k = size[to]; k >= 0; k--)
        f[p][j + k] = max(f[p][j + k], f[p][j] * f[to][k]);
    size[p] += size[to];
  }
  for (int i = 1; i <= size[p]; i++) f[p][0] = max(f[p][0], f[p][i] * tran(i));
}
void ceshi() {
  Big a, b;
  int x, y;
  cin >> x >> y;
  a.fuzhi(x);
  b.fuzhi(y);
  a.out();
  b.out();
  a = a * b;
  a.out();
  exit(0);
}
int main() {
  std::ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i < n; i++) {
    int x, y;
    cin >> x >> y;
    add(x, y);
    add(y, x);
  }
  dfs(1, 0);
  f[1][0].out();
  return 0;
}
