Recently Bob invented a new game with a tree (we should remind you, that a tree is a connected graph without cycles): he deletes any (possibly, zero) amount of edges of the tree, and counts the product of sizes of the connected components left after the deletion. Your task is to find out the maximum number that Bob can get in his new game for a given tree.

Input

The first input line contains integer number n (1 ≤ n ≤ 700) — amount of vertices in the tree. The following n - 1 lines contain the description of the edges. Each line contains the pair of vertices' indexes, joined by an edge, ai, bi (1 ≤ ai, bi ≤ n). It's guaranteed that the graph described in the input is a tree.

Output

Output the only number — the maximum product of sizes of the connected components, that Bob can get after deleting some of the tree's edges.

Examples

Input

5
1 2
2 3
3 4
4 5


Output

6

Input

8
1 2
1 3
2 4
2 5
3 6
3 7
6 8


Output

18

Input

3
1 2
1 3


Output

3
#include <bits/stdc++.h>
using namespace std;
template <typename T>
void read(T& x) {
  x = 0;
  char c = getchar();
  int f = 1;
  for (; c < '0' || c > '9'; c = getchar())
    if (c == '-') f = -f;
  for (; c >= '0' && c <= '9'; c = getchar()) x = x * 10 + (c - '0');
  x *= f;
}
template <typename T>
void write(T x) {
  static char q[64];
  int cnt = 0;
  if (x < 0) putchar('-'), x = -x;
  q[cnt++] = x % 10 + '0', x /= 10;
  while (x) q[cnt++] = x % 10 + '0', x /= 10;
  while (cnt--) putchar(q[cnt]);
}
const int Base = 10000;
struct Imakf {
  int aker[50];
  Imakf(void) { memset(aker, 0, sizeof aker); }
  Imakf operator=(const int o) {
    int tmp = 0;
    int co = o;
    while (co) {
      aker[++tmp] = co % Base;
      co /= Base;
    }
    aker[0] = tmp;
    return *this;
  }
  Imakf operator*(const int o) const {
    Imakf re;
    int tmp = aker[0], nt = 0;
    for (int i = 1; i <= tmp; ++i) {
      re.aker[i] = aker[i] * o + nt;
      nt = re.aker[i] / Base;
      re.aker[i] %= Base;
    }
    re.aker[0] = tmp;
    if (nt) re.aker[++re.aker[0]] = nt;
    return re;
  }
  bool operator<(const Imakf o) const {
    int tmp = aker[0];
    if (tmp < o.aker[0]) return true;
    if (tmp > o.aker[0]) return false;
    for (int i = tmp; i >= 1; --i) {
      if (aker[i] < o.aker[i]) return true;
      if (aker[i] > o.aker[i]) return false;
    }
    return false;
  }
  Imakf operator*(const Imakf o) const {
    Imakf re;
    int tmp0 = aker[0], tmp1 = o.aker[0];
    re.aker[0] = tmp0 + tmp1;
    for (int i = 1; i <= tmp0; ++i) {
      for (int j = 1; j <= tmp1; ++j) {
        re.aker[i + j - 1] += aker[i] * o.aker[j];
        int no = i + j - 1;
        while (re.aker[no] >= Base) {
          re.aker[no + 1] += re.aker[no] / Base;
          re.aker[no] %= Base;
          ++no;
        }
      }
    }
    while (re.aker[0] > 0 && !re.aker[re.aker[0]]) --re.aker[0];
    return re;
  }
  void out(void) {
    int tmp = aker[0];
    write(aker[tmp--]);
    while (tmp) {
      printf("%04d", aker[tmp]);
      --tmp;
    }
  }
};
const int maxn = 706;
struct Edge {
  int v, nt;
  Edge(int v = 0, int nt = 0) : v(v), nt(nt) {}
} e[maxn * 2];
int hd[maxn], num;
void qwq(int u, int v) {
  e[++num] = Edge(v, hd[u]);
  hd[u] = num;
}
Imakf dp[maxn][maxn];
int sz[maxn];
void solve(int u, int fa) {
  dp[u][1] = 1;
  sz[u] = 1;
  for (int i = hd[u]; i; i = e[i].nt) {
    int v = e[i].v;
    if (v == fa) continue;
    solve(v, u);
    for (int i = sz[u]; i >= 0; --i) {
      for (int j = sz[v]; j >= 0; --j) {
        dp[u][i + j] = max(dp[u][i + j], dp[v][j] * dp[u][i]);
      }
    }
    sz[u] += sz[v];
  }
  dp[u][0] = sz[u];
  for (int i = 1; i <= sz[u]; ++i) dp[u][0] = max(dp[u][0], dp[u][i] * i);
}
int main() {
  int n;
  read(n);
  for (int i = 1; i < n; ++i) {
    int u, v;
    read(u), read(v);
    qwq(u, v);
    qwq(v, u);
  }
  solve(1, 0);
  dp[1][0].out(), putchar('\n');
  return 0;
}
