#include <bits/stdc++.h>
using namespace std;
const int maxn = 1410;
int P[maxn], N[maxn], F[maxn], E;
int size[maxn], n;
bool v[maxn];
struct bignum {
  int len;
  int a[100];
  int& operator[](int k) { return a[k]; }
  void print() {
    if (!len) len++;
    printf("%d", a[len]);
    for (int i = len - 1; i > 0; i--) printf("%04d", a[i]);
  }
  void operator=(int b) {
    memset(a, 0, sizeof a);
    len = 1;
    a[1] = b;
  }
  bignum operator*(bignum b) {
    bignum c;
    c = 0;
    for (int i = 1; i <= len; i++)
      for (int j = 1; j <= b.len; j++) {
        c[i + j - 1] += a[i] * b[j];
        c[i + j] += c[i + j - 1] / 10000;
        c[i + j - 1] %= 10000;
      }
    c.len = len + b.len - 1;
    while (c[c.len + 1]) {
      c.len++;
      c[c.len + 1] += c[c.len] / 10000;
      c[c.len] %= 10000;
    }
    return c;
  }
} f[710][710];
bignum max(bignum a, bignum b) {
  if (a.len != b.len) return a.len > b.len ? a : b;
  for (int i = a.len; i >= 1; i--)
    if (a[i] != b[i]) return a[i] > b[i] ? a : b;
  return a;
}
void add(int u, int v) {
  P[++E] = v;
  N[E] = F[u];
  F[u] = E;
}
void dfs(int x) {
  size[x] = v[x] = 1;
  f[x][1] = 1;
  for (int k = F[x]; k; k = N[k])
    if (!v[P[k]]) {
      dfs(P[k]);
      for (int j = size[x]; j >= 1; j--)
        for (int i = size[P[k]]; i >= 0; i--)
          f[x][i + j] = max(f[x][i + j], f[P[k]][i] * f[x][j]);
      size[x] += size[P[k]];
    }
  f[x][0] = size[x];
  for (int i = 1; i < size[x]; i++) {
    bignum r;
    r = i;
    f[x][0] = max(f[x][0], f[x][i] * r);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    add(x, y), add(y, x);
  }
  dfs(1);
  f[1][0].print();
  return 0;
}
