#include <bits/stdc++.h>
using namespace std;
struct Num {
  const long long base = 1e4;
  int a[30];
  int len;
  void init() {
    len = 1;
    memset(a, 0, sizeof a);
  }
  void show() {
    printf("%d", a[len]);
    for (int i = len - 1; i >= 1; i--) printf("%04d", a[i]);
  }
  Num operator*(const Num x) {
    Num res;
    res.init();
    for (int i = 1; i <= len; i++)
      for (int j = 1; j <= x.len; j++)
        res.a[i + j - 1] += a[i] * x.a[j],
            res.a[i + j] += res.a[i + j - 1] / base, res.a[i + j - 1] %= base;
    res.len = len + x.len - 1;
    for (int i = 1; i <= res.len; i++) {
      res.a[i + 1] += res.a[i] / base;
      res.a[i] %= base;
      if (res.a[i + 1]) res.len = max(res.len, i + 1);
    }
    return res;
  }
  Num operator*(const int x) {
    Num res;
    res.init();
    for (int i = 1; i <= len; i++) res.a[i] = a[i] * x;
    res.len = len;
    for (int i = 1; i <= res.len; i++) {
      res.a[i + 1] += res.a[i] / base;
      res.a[i] %= base;
      if (res.a[i + 1]) res.len = max(res.len, i + 1);
    }
    return res;
  }
  Num operator+(const Num x) {
    Num res;
    res.init(), res.len = max(len, x.len);
    for (int i = 1; i <= res.len; i++) {
      res.a[i] += a[i] + x.a[i];
      res.a[i + 1] += res.a[i] % base;
      res.a[i] %= base;
      if (res.a[i + 1] && i == res.len) {
        res.len++;
        break;
      }
    }
    return res;
  }
  void operator=(const int _x) {
    memset(a, 0, sizeof a);
    len = 0;
    int x = _x;
    while (x) a[++len] = x % base, x /= base;
    len = max(len, 1);
  }
  void operator=(const Num _x) {
    len = _x.len;
    for (int i = 0; i < 30; i++) a[i] = _x.a[i];
  }
  bool operator<(const Num x) {
    if (len != x.len) return len < x.len;
    for (int i = len; i >= 1; i--)
      if (a[i] != x.a[i]) return a[i] < x.a[i];
    return false;
  }
};
void dfs(vector<vector<long long>> &egg, long long u, long long par,
         vector<long long> &vis) {
  vis[u] = 1;
  for (auto v : egg[u]) {
    if (vis[v] == 0) dfs(egg, v, u, vis);
  }
}
void dfs1(vector<long long> &cost, vector<vector<Num>> &dp,
          vector<vector<long long>> &egg, long long u, long long par) {
  dp[u][1] = 1;
  cost[u] = 1;
  for (auto v : egg[u]) {
    if (v == par) continue;
    dfs1(cost, dp, egg, v, u);
    for (int i = cost[u]; ~i; i--) {
      for (int j = cost[v]; ~j; j--) {
        Num temp = (dp[u][i] * dp[v][j]);
        if (dp[u][i + j] < temp) dp[u][i + j] = temp;
      }
    }
    cost[u] += cost[v];
  }
  for (int i = 0; i <= cost[u]; i++) {
    Num temp = (dp[u][i] * i);
    if (dp[u][0] < temp) dp[u][0] = temp;
  }
}
int main() {
  long long a, b, c, d, e, f, s, k, t, n, m, x;
  t = 1;
  string s1, s2;
  long long pp = 1000000007;
  while (t--) {
    cin >> n;
    m = n - 1;
    vector<vector<long long>> egg(n + 10);
    for (int i = 0; i < m; i++) {
      cin >> a >> b;
      egg[a].push_back(b);
      egg[b].push_back(a);
    }
    vector<long long> cost(n + 10, 0);
    vector<vector<Num>> dp(n + 10, vector<Num>(n + 10));
    dfs1(cost, dp, egg, 1, 0);
    dp[1][0].show();
  }
  return 0;
}
