#include <bits/stdc++.h>
using namespace std;
const int MAXN = 705;
template <typename T>
inline void read(T &x) {
  x = 0;
  char temp = getchar();
  bool f = false;
  while (!isdigit(temp)) {
    if (temp == '-') f = true;
    temp = getchar();
  }
  while (isdigit(temp)) {
    x = (x << 1) + (x << 3) + temp - '0';
    temp = getchar();
  }
  if (f) x = -x;
}
template <typename T>
void print(T x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) print(x / 10);
  putchar(x % 10 + '0');
}
struct HP {
  int digit[120], len;
  HP() { memset(digit, 0, sizeof(digit)), len = 0; }
  HP(int num) {
    memset(digit, 0, sizeof(digit)), len = 0;
    while (num > 0) digit[++len] = num % 10, num /= 10;
  }
  inline void clear() { memset(digit, 0, sizeof(digit)), len = 0; }
  inline void out() {
    for (register int i = len; i >= 1; i--) print(digit[i]);
  }
  inline bool operator<(const HP &num) const {
    if (len != num.len) return len < num.len ? true : false;
    for (register int i = len; i >= 0; i--)
      if (digit[i] != num.digit[i])
        return digit[i] < num.digit[i] ? true : false;
  }
  inline HP operator*(const HP &num) {
    HP res;
    res.clear();
    int carry = 0;
    for (register int i = 1; i <= len; i++) {
      for (register int j = 1; j <= num.len; j++) {
        res.digit[i + j - 1] += digit[i] * num.digit[j] + carry;
        carry = res.digit[i + j - 1] / 10, res.digit[i + j - 1] %= 10;
      }
      res.len = i + num.len - 1;
      while (carry > 0) res.digit[++res.len] = carry % 10, carry /= 10;
    }
    while (res.digit[res.len] == 0 && res.len > 0) res.len--;
    if (res.len == 0) res.len++;
    return res;
  }
};
inline HP max(const HP &a, const HP &b) { return a < b ? b : a; }
int n;
struct node {
  int to, next;
} edge[MAXN << 1];
int head[MAXN], cnt;
inline void AddEdge(int u, int v) {
  edge[++cnt] = (node){v, head[u]}, head[u] = cnt;
}
inline void Add(int u, int v) { AddEdge(u, v), AddEdge(v, u); }
int size[MAXN];
HP f[MAXN][MAXN], ans;
void Dfs(int id, int fa) {
  size[id] = 1, f[id][1] = 1;
  for (register int i = head[id]; i; i = edge[i].next) {
    int son = edge[i].to;
    if (son != fa) {
      Dfs(son, id);
      for (register int x = size[id]; x >= 0; x--)
        for (register int y = size[son]; y >= 0; y--)
          f[id][x + y] = max(f[id][x + y], f[id][x] * f[son][y]);
      size[id] += size[son];
    }
  }
  for (register int i = 1; i <= size[id]; i++)
    f[id][0] = max(f[id][0], f[id][i] * HP(i));
}
int main() {
  read(n);
  for (register int i = 1, u, v; i < n; i++) read(u), read(v), Add(u, v);
  Dfs(1, 0);
  f[1][0].out();
  return 0;
}

### Prompt

Your task is to create 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;
const int MAXN = 705;
template <typename T>
inline void read(T &x) {
  x = 0;
  char temp = getchar();
  bool f = false;
  while (!isdigit(temp)) {
    if (temp == '-') f = true;
    temp = getchar();
  }
  while (isdigit(temp)) {
    x = (x << 1) + (x << 3) + temp - '0';
    temp = getchar();
  }
  if (f) x = -x;
}
template <typename T>
void print(T x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) print(x / 10);
  putchar(x % 10 + '0');
}
struct HP {
  int digit[120], len;
  HP() { memset(digit, 0, sizeof(digit)), len = 0; }
  HP(int num) {
    memset(digit, 0, sizeof(digit)), len = 0;
    while (num > 0) digit[++len] = num % 10, num /= 10;
  }
  inline void clear() { memset(digit, 0, sizeof(digit)), len = 0; }
  inline void out() {
    for (register int i = len; i >= 1; i--) print(digit[i]);
  }
  inline bool operator<(const HP &num) const {
    if (len != num.len) return len < num.len ? true : false;
    for (register int i = len; i >= 0; i--)
      if (digit[i] != num.digit[i])
        return digit[i] < num.digit[i] ? true : false;
  }
  inline HP operator*(const HP &num) {
    HP res;
    res.clear();
    int carry = 0;
    for (register int i = 1; i <= len; i++) {
      for (register int j = 1; j <= num.len; j++) {
        res.digit[i + j - 1] += digit[i] * num.digit[j] + carry;
        carry = res.digit[i + j - 1] / 10, res.digit[i + j - 1] %= 10;
      }
      res.len = i + num.len - 1;
      while (carry > 0) res.digit[++res.len] = carry % 10, carry /= 10;
    }
    while (res.digit[res.len] == 0 && res.len > 0) res.len--;
    if (res.len == 0) res.len++;
    return res;
  }
};
inline HP max(const HP &a, const HP &b) { return a < b ? b : a; }
int n;
struct node {
  int to, next;
} edge[MAXN << 1];
int head[MAXN], cnt;
inline void AddEdge(int u, int v) {
  edge[++cnt] = (node){v, head[u]}, head[u] = cnt;
}
inline void Add(int u, int v) { AddEdge(u, v), AddEdge(v, u); }
int size[MAXN];
HP f[MAXN][MAXN], ans;
void Dfs(int id, int fa) {
  size[id] = 1, f[id][1] = 1;
  for (register int i = head[id]; i; i = edge[i].next) {
    int son = edge[i].to;
    if (son != fa) {
      Dfs(son, id);
      for (register int x = size[id]; x >= 0; x--)
        for (register int y = size[son]; y >= 0; y--)
          f[id][x + y] = max(f[id][x + y], f[id][x] * f[son][y]);
      size[id] += size[son];
    }
  }
  for (register int i = 1; i <= size[id]; i++)
    f[id][0] = max(f[id][0], f[id][i] * HP(i));
}
int main() {
  read(n);
  for (register int i = 1, u, v; i < n; i++) read(u), read(v), Add(u, v);
  Dfs(1, 0);
  f[1][0].out();
  return 0;
}

```