#include <bits/stdc++.h>
using namespace std;
namespace zyf {
struct bign {
  static const int maxlen = 50, limit = 10000, width = 4;
  int len, bit[maxlen];
  int& operator[](int p) { return bit[p]; }
  void ClearBit() { memset(bit, 0, sizeof(bit)); }
  void Delete0() {
    for (; !bit[len - 1] && len > 1; --len)
      ;
  }
  bign(int p = 0) { *this = p; }
  bign& operator=(int p) {
    ClearBit();
    len = p ? 0 : 1;
    for (; p; p /= limit) bit[len++] = p % limit;
    return *this;
  }
  bign& operator*=(bign b) {
    bign a = *this;
    ClearBit();
    len = a.len + b.len;
    for (int i = 0; i < a.len; ++i)
      for (int j = 0; j < b.len; ++j)
        bit[i + j] += a[i] * b[j], bit[i + j + 1] += bit[i + j] / limit,
            bit[i + j] %= limit;
    Delete0();
    return *this;
  }
  bign& operator/=(int b) {
    for (int i = len - 1; i > 0; --i)
      bit[i - 1] += limit * (bit[i] % b), bit[i] /= b;
    bit[0] /= b;
    Delete0();
    return *this;
  }
  bool operator<(bign b) const {
    if (len > b.len) return false;
    if (len < b.len) return true;
    for (int i = len - 1; i >= 0; --i)
      if (bit[i] != b[i]) return bit[i] < b[i];
    return bit[0] < b[0];
  }
};
bign operator*(bign a, bign b) { return a *= b; }
bign operator/(bign a, int b) { return a /= b; }
ostream& operator<<(ostream& os, bign p) {
  os.fill('0');
  os << p.bit[p.len - 1];
  for (int i = p.len - 2; i >= 0; --i) {
    os.width(bign::width);
    os << p.bit[i];
  }
  return os;
}
}  // namespace zyf
using zyf::bign;
const int maxn = 710;
struct Tedge {
  int son;
  Tedge* pre;
  void add(int s_, Tedge* p_) { son = s_, pre = p_; }
} edge[2 * maxn], *pos[maxn];
int tot;
void clear() {
  tot = 0;
  memset(pos, 0, sizeof(pos));
}
void add(int a, int b) { edge[++tot].add(b, pos[a]), pos[a] = edge + tot; }
int size[maxn];
int n;
void get_size(int now, int fa) {
  size[now] = 1;
  for (Tedge* i = pos[now]; i; i = i->pre)
    if (i->son != fa) {
      get_size(i->son, now);
      size[now] += size[i->son];
    }
}
void init() {
  scanf("%d", &n);
  clear();
  for (int i = 1; i <= n - 1; ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    add(a, b), add(b, a);
  }
  get_size(1, 0);
}
bign f[maxn][maxn];
void dp(int now, int fa) {
  f[now][1] = 1;
  int done_size = 1;
  for (Tedge* i = pos[now]; i; i = i->pre)
    if (i->son != fa) {
      dp(i->son, now);
      for (int j = done_size; j >= 1; --j) {
        bign tmp = f[now][j];
        for (int k = 1; k <= size[i->son]; ++k) {
          f[now][j] = max(f[now][j], f[i->son][k] * tmp);
          f[now][j + k] =
              max(f[now][j + k], f[i->son][k] / k * tmp / j * (j + k));
        }
      }
      done_size += size[i->son];
    }
}
void tree_dp() {
  dp(1, 0);
  bign ans = 0;
  for (int i = 1; i <= size[1]; ++i) ans = max(ans, f[1][i]);
  cout << ans << endl;
}
int main() {
  init();
  tree_dp();
  return 0;
}

### Prompt

Please formulate a CPP solution to 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;
namespace zyf {
struct bign {
  static const int maxlen = 50, limit = 10000, width = 4;
  int len, bit[maxlen];
  int& operator[](int p) { return bit[p]; }
  void ClearBit() { memset(bit, 0, sizeof(bit)); }
  void Delete0() {
    for (; !bit[len - 1] && len > 1; --len)
      ;
  }
  bign(int p = 0) { *this = p; }
  bign& operator=(int p) {
    ClearBit();
    len = p ? 0 : 1;
    for (; p; p /= limit) bit[len++] = p % limit;
    return *this;
  }
  bign& operator*=(bign b) {
    bign a = *this;
    ClearBit();
    len = a.len + b.len;
    for (int i = 0; i < a.len; ++i)
      for (int j = 0; j < b.len; ++j)
        bit[i + j] += a[i] * b[j], bit[i + j + 1] += bit[i + j] / limit,
            bit[i + j] %= limit;
    Delete0();
    return *this;
  }
  bign& operator/=(int b) {
    for (int i = len - 1; i > 0; --i)
      bit[i - 1] += limit * (bit[i] % b), bit[i] /= b;
    bit[0] /= b;
    Delete0();
    return *this;
  }
  bool operator<(bign b) const {
    if (len > b.len) return false;
    if (len < b.len) return true;
    for (int i = len - 1; i >= 0; --i)
      if (bit[i] != b[i]) return bit[i] < b[i];
    return bit[0] < b[0];
  }
};
bign operator*(bign a, bign b) { return a *= b; }
bign operator/(bign a, int b) { return a /= b; }
ostream& operator<<(ostream& os, bign p) {
  os.fill('0');
  os << p.bit[p.len - 1];
  for (int i = p.len - 2; i >= 0; --i) {
    os.width(bign::width);
    os << p.bit[i];
  }
  return os;
}
}  // namespace zyf
using zyf::bign;
const int maxn = 710;
struct Tedge {
  int son;
  Tedge* pre;
  void add(int s_, Tedge* p_) { son = s_, pre = p_; }
} edge[2 * maxn], *pos[maxn];
int tot;
void clear() {
  tot = 0;
  memset(pos, 0, sizeof(pos));
}
void add(int a, int b) { edge[++tot].add(b, pos[a]), pos[a] = edge + tot; }
int size[maxn];
int n;
void get_size(int now, int fa) {
  size[now] = 1;
  for (Tedge* i = pos[now]; i; i = i->pre)
    if (i->son != fa) {
      get_size(i->son, now);
      size[now] += size[i->son];
    }
}
void init() {
  scanf("%d", &n);
  clear();
  for (int i = 1; i <= n - 1; ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    add(a, b), add(b, a);
  }
  get_size(1, 0);
}
bign f[maxn][maxn];
void dp(int now, int fa) {
  f[now][1] = 1;
  int done_size = 1;
  for (Tedge* i = pos[now]; i; i = i->pre)
    if (i->son != fa) {
      dp(i->son, now);
      for (int j = done_size; j >= 1; --j) {
        bign tmp = f[now][j];
        for (int k = 1; k <= size[i->son]; ++k) {
          f[now][j] = max(f[now][j], f[i->son][k] * tmp);
          f[now][j + k] =
              max(f[now][j + k], f[i->son][k] / k * tmp / j * (j + k));
        }
      }
      done_size += size[i->son];
    }
}
void tree_dp() {
  dp(1, 0);
  bign ans = 0;
  for (int i = 1; i <= size[1]; ++i) ans = max(ans, f[1][i]);
  cout << ans << endl;
}
int main() {
  init();
  tree_dp();
  return 0;
}

```