#include <bits/stdc++.h>
using namespace std;
int n;
struct edge {
  int y, next;
} e[710 << 1];
int first[710], len = 0;
void buildroad(int x, int y) {
  e[++len] = (edge){y, first[x]};
  first[x] = len;
}
struct GJD {
  int a[120], t;
  GJD() {
    memset(a, 0, sizeof(a));
    t = 1;
  }
  int &operator[](int x) { return a[x]; }
  void pushup() {
    for (int i = 1; i <= t; i++)
      if (a[i] > 9) {
        a[i + 1] += a[i] / 10;
        a[i] %= 10;
        if (i == t) t++;
      }
    while (t > 1 && !a[t]) t--;
  }
  GJD operator*(int x) {
    GJD re;
    re.t = t;
    for (int i = 1; i <= t; i++) re[i] = a[i] * x;
    re.pushup();
    return re;
  }
  GJD operator*(GJD &B) {
    GJD re;
    re.t = t + B.t - 1;
    for (int i = 1; i <= t; i++) {
      for (int j = 1; j <= B.t; j++) {
        re[i + j - 1] += a[i] * B[j];
      }
    }
    re.pushup();
    return re;
  }
  bool operator<(const GJD &B) const {
    if (t < B.t) return true;
    if (t > B.t) return false;
    for (int i = t; i >= 1; i--) {
      if (a[i] < B.a[i]) return true;
      if (a[i] > B.a[i]) return false;
    }
    return false;
  }
  void print() {
    for (int i = t; i >= 1; i--) printf("%d", a[i]);
  }
};
vector<GJD> f[710];
GJD ept;
int sz[710];
void dfs(int x, int fa) {
  f[x].push_back(ept);
  f[x].push_back(ept);
  f[x][1][1] = sz[x] = 1;
  for (int i = first[x]; i; i = e[i].next) {
    int y = e[i].y;
    if (y == fa) continue;
    dfs(y, x);
    sz[x] += sz[y];
    for (int j = 1; j <= sz[y]; j++) f[x].push_back(ept);
    GJD ma, ma2;
    for (int j = 1; j <= sz[y]; j++) ma = max(ma, f[y][j] * j);
    for (int j = sz[x]; j >= 1; j--) {
      ma2 = f[x][j] * ma;
      for (int k = min(j - 1, sz[y]); k >= 1 && j - k <= sz[x] - sz[y]; k--) {
        f[x][j] = max(f[x][j], f[x][j - k] * f[y][k]);
      }
      f[x][j] = max(f[x][j], ma2);
    }
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1, x, y; i < n; i++) {
    scanf("%d %d", &x, &y);
    buildroad(x, y);
    buildroad(y, x);
  }
  dfs(1, 0);
  GJD ans;
  for (int i = 1; i <= n; i++) ans = max(ans, f[1][i] * i);
  ans.print();
}
