#include <bits/stdc++.h>
using namespace std;
const int N = 700 + 10;
struct bignum {
  vector<int> d;
  bool sgn;
  bignum(int z = 0) {
    d.clear();
    d.push_back(z);
    relax();
  }
  void print(void) {
    for (int i = (int)d.size() - 1; i >= 0; i--) printf("%d", d[i]);
    printf("\n");
  }
  void relax(void) {
    while ((int)d.size() > 1 && !d.back()) d.pop_back();
    for (int i = 0; i + 1 < (int)d.size(); i++) {
      d[i + 1] += d[i] / 10;
      d[i] %= 10;
    }
    while ((int)d.size() && d.back() >= 10) {
      d.push_back(d.back() / 10);
      d[(int)d.size() - 2] %= 10;
    }
  }
  void operator=(int a) {
    d.clear();
    d.push_back(a);
    relax();
  }
  void operator=(bignum a) {
    d.clear();
    d = a.d;
    relax();
  }
  bool operator<(bignum a) const {
    if ((int)a.d.size() != (int)d.size()) return d.size() < a.d.size();
    for (int i = (int)d.size() - 1; i >= 0; i--)
      if (a.d[i] != d[i]) return d[i] < a.d[i];
    return false;
  }
  bignum operator+(bignum a) const {
    bignum res = *this;
    if ((int)res.d.size() < (int)a.d.size()) res.d.resize((int)a.d.size());
    for (int i = 0; i < (int)a.d.size(); i++) res.d[i] += a.d[i];
    res.relax();
    return res;
  }
  bignum operator*(bignum a) const {
    bignum res;
    res.d.resize(a.d.size() + d.size() - 1);
    for (int i = 0; i < (int)d.size(); i++)
      for (int j = 0; j < (int)a.d.size(); j++) res.d[i + j] += d[i] * a.d[j];
    res.relax();
    return res;
  }
  bignum operator/(bignum a) const {
    bignum res;
    res.d.resize(max(1, (int)d.size() - (int)a.d.size() + 2));
    bignum sum;
    for (int i = (int)res.d.size() - 1; i >= 0; i--) {
      bignum x;
      x.d.resize((int)a.d.size() + i);
      for (int j = 0; j < (int)a.d.size(); j++) x.d[j + i] = a.d[j];
      x.relax();
      while (1) {
        if (!(operator<(sum + x)))
          sum = sum + x;
        else
          break;
        res.d[i]++;
      }
    }
    res.relax();
    return res;
  }
} dp[N][N];
inline void setmax(bignum& a, bignum b) {
  if (a < b) a = b;
}
vector<int> adj[N];
int n, subsz[N];
const int root = 1;
inline void dfs(int v, int p = -1) {
  subsz[v] = 1;
  dp[v][1] = 1;
  for (int u : adj[v]) {
    if (u == p) continue;
    dfs(u, v);
    for (int k = subsz[v]; k > 0; k--)
      for (int l = subsz[u]; l >= 0; l--)
        setmax(dp[v][k + l], dp[v][k] * dp[u][l]);
    subsz[v] += subsz[u];
  }
  for (int j = 1; j <= subsz[v]; j++) setmax(dp[v][0], dp[v][j] * j);
  setmax(dp[v][0], bignum(subsz[v]));
}
int main() {
  scanf("%d", &n);
  int a, b;
  for (int i = 1; i < n; i++) {
    scanf("%d%d", &a, &b);
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  dfs(1);
  dp[1][0].print();
  return 0;
}
