#include <bits/stdc++.h>
using namespace std;
const int maxn = 705;
const int N = 15;
int outbuf[9];
struct BigInt {
  int len, v[N + 1];
  BigInt() {
    len = 0;
    memset(v, 0, sizeof(v));
  }
  BigInt(int a) {
    len = 1;
    memset(v, 0, sizeof(v));
    v[1] = a;
  }
  void print() {
    cout << v[len];
    for (int i = len - 1; i >= 1; i--) {
      int x = v[i];
      for (int j = 0; j < 8; ++j) {
        outbuf[j] = x % 10;
        x /= 10;
      }
      for (int j = 7; j >= 0; j--) {
        cout << outbuf[j];
      }
    }
    cout << endl;
  }
};
BigInt operator*(const BigInt& a, const BigInt& b) {
  BigInt c;
  int x = 0, j, i;
  long long now;
  for (int i = 1; i < a.len + 1; ++i) {
    x = 0;
    for (int j = 1; j < b.len + 1; ++j) {
      now = ((long long)a.v[i]) * b.v[j] + c.v[i + j - 1] + x;
      x = now / 100000000;
      c.v[i + j - 1] = now % 100000000;
    }
    c.v[i + b.len] = x;
  }
  c.len = a.len + b.len - 1;
  if (c.v[c.len + 1] != 0) {
    c.len++;
  }
  return c;
}
bool operator<(const BigInt& a, const BigInt& b) {
  if (a.len != b.len) {
    return a.len < b.len;
  }
  for (int i = a.len; i >= 1; i--) {
    if (a.v[i] != b.v[i]) {
      return a.v[i] < b.v[i];
    }
  }
  return false;
}
struct edge {
  int y, n;
};
int n, i, num[maxn], son[maxn];
edge t[2 * maxn];
BigInt f[maxn][maxn];
void dfs(int x) {
  int e = num[x];
  f[x][1].len = 1;
  f[x][1].v[1] = 1;
  son[x] = 1;
  while (e != 0) {
    if (t[e].y != 0) {
      if (e % 2 == 0) {
        t[e - 1].y = 0;
      } else {
        t[e + 1].y = 0;
      }
      dfs(t[e].y);
      son[x] += son[t[e].y];
      for (int i = son[x]; i >= 2; i--) {
        f[x][i] = f[x][i] * f[t[e].y][0];
        f[x][i] = max(f[x][i], f[x][1] * f[t[e].y][i - 1]);
        f[x][i] = max(f[x][i], f[x][i - 1] * f[t[e].y][1]);
      }
      f[x][1] = f[x][1] * f[t[e].y][0];
    }
    e = t[e].n;
  }
  for (int i = 1; i < son[x] + 1; ++i) {
    f[x][0] = max(f[x][0], f[x][i] * BigInt(i));
  }
}
int main() {
  cin >> n;
  int x, y, e = 0;
  for (int i = 1; i < n; ++i) {
    cin >> x >> y;
    t[++e].y = y;
    t[e].n = num[x];
    num[x] = e;
    t[++e].y = x;
    t[e].n = num[y];
    num[y] = e;
  }
  dfs(1);
  f[1][0].print();
}
