#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;
}

### Prompt

In cpp, your task is to solve the following problem:

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

### Response

```cpp
#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;
}

```