#include <bits/stdc++.h>
using namespace std;
long long MulModL(long long B, long long P, long long M) {
  long long R = 0;
  while (P > 0) {
    if ((P & 1ll) == 1) {
      R = (R + B);
      if (R >= M) R -= M;
    }
    P >>= 1ll;
    B = (B + B);
    if (B >= M) B -= M;
  }
  return R;
}
long long MulModD(long long B, long long P, long long M) {
  long long I = ((long double)B * (long double)P / (long double)M);
  long long R = B * P - M * I;
  R = (R % M + M) % M;
  return R;
}
long long BigMod(long long B, long long P, long long M) {
  long long R = 1;
  while (P > 0) {
    if (P % 2 == 1) {
      R = (R * B) % M;
    }
    P /= 2;
    B = (B * B) % M;
  }
  return R;
}
template <class T1>
void deb(T1 e1) {
  cout << e1 << "\n";
}
template <class T1, class T2>
void deb(T1 e1, T2 e2) {
  cout << e1 << " " << e2 << "\n";
}
template <class T1, class T2, class T3>
void deb(T1 e1, T2 e2, T3 e3) {
  cout << e1 << " " << e2 << " " << e3 << "\n";
}
template <class T1, class T2, class T3, class T4>
void deb(T1 e1, T2 e2, T3 e3, T4 e4) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << "\n";
}
template <class T1, class T2, class T3, class T4, class T5>
void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << "\n";
}
template <class T1, class T2, class T3, class T4, class T5, class T6>
void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5, T6 e6) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << " " << e6
       << "\n";
}
const int K = 10000;
const int L = 4;
struct BigInteger {
  int a[35];
  BigInteger(int x = 0) {
    memset(a, 0, sizeof(a));
    if (!x)
      a[0] = 1;
    else
      for (; x; x /= K) a[++a[0]] = x % K;
  }
  friend bool operator<(const BigInteger& A, const BigInteger& B) {
    if (A[0] < B[0]) return 1;
    if (A[0] > B[0]) return 0;
    int i = A[0];
    for (; A[i] == B[i] && i > 1; i--)
      ;
    return A[i] < B[i];
  }
  friend BigInteger operator*(const BigInteger& A, const BigInteger& B) {
    BigInteger C;
    C[0] = A[0] + B[0] + 1;
    for (int i = 1; i <= A[0]; i++)
      for (int j = 1; j <= B[0]; j++) {
        C[i + j - 1] += A[i] * B[j];
        C[i + j] += C[i + j - 1] / K;
        C[i + j - 1] %= K;
      }
    for (; C[0] > 1 && !C[C[0]]; C[0]--)
      ;
    return C;
  }
  int& operator[](int x) { return a[x]; }
  const int& operator[](int x) const { return a[x]; }
  void print() const {
    printf("%d", a[a[0]]);
    for (int i = a[0] - 1; i; i--) printf("%0*d", L, a[i]);
    printf("\n");
  }
};
const int MAX = 750;
BigInteger dp[750][750];
vector<int> adj[MAX];
int child[MAX];
void dfs(int u, int par) {
  child[u] = 1;
  dp[u][0] = 0;
  dp[u][1] = 1;
  int n = ((int)adj[u].size()), v;
  BigInteger tmp;
  for (int i = 0; i < n; i++) {
    v = adj[u][i];
    if (v == par) continue;
    dfs(v, u);
    for (int j = child[u]; j >= 0; j--) {
      for (int k = child[v]; k >= 0; k--) {
        tmp = dp[u][j] * dp[v][k];
        if (dp[u][j + k] < tmp) {
          dp[u][j + k] = tmp;
        }
      }
    }
    child[u] += child[v];
  }
  for (int i = 1; i <= child[u]; i++) {
    tmp = dp[u][i] * i;
    if (dp[u][0] < tmp) dp[u][0] = tmp;
  }
  return;
}
int main() {
  int n;
  scanf("%d", &n);
  int u, v;
  for (int i = 1; i < n; i++) {
    scanf("%d %d", &u, &v);
    adj[u].push_back((v));
    adj[v].push_back((u));
  }
  dfs(1, 1);
  dp[1][0].print();
  return 0;
}

### Prompt

Create a solution in cpp for 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;
long long MulModL(long long B, long long P, long long M) {
  long long R = 0;
  while (P > 0) {
    if ((P & 1ll) == 1) {
      R = (R + B);
      if (R >= M) R -= M;
    }
    P >>= 1ll;
    B = (B + B);
    if (B >= M) B -= M;
  }
  return R;
}
long long MulModD(long long B, long long P, long long M) {
  long long I = ((long double)B * (long double)P / (long double)M);
  long long R = B * P - M * I;
  R = (R % M + M) % M;
  return R;
}
long long BigMod(long long B, long long P, long long M) {
  long long R = 1;
  while (P > 0) {
    if (P % 2 == 1) {
      R = (R * B) % M;
    }
    P /= 2;
    B = (B * B) % M;
  }
  return R;
}
template <class T1>
void deb(T1 e1) {
  cout << e1 << "\n";
}
template <class T1, class T2>
void deb(T1 e1, T2 e2) {
  cout << e1 << " " << e2 << "\n";
}
template <class T1, class T2, class T3>
void deb(T1 e1, T2 e2, T3 e3) {
  cout << e1 << " " << e2 << " " << e3 << "\n";
}
template <class T1, class T2, class T3, class T4>
void deb(T1 e1, T2 e2, T3 e3, T4 e4) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << "\n";
}
template <class T1, class T2, class T3, class T4, class T5>
void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << "\n";
}
template <class T1, class T2, class T3, class T4, class T5, class T6>
void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5, T6 e6) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << " " << e6
       << "\n";
}
const int K = 10000;
const int L = 4;
struct BigInteger {
  int a[35];
  BigInteger(int x = 0) {
    memset(a, 0, sizeof(a));
    if (!x)
      a[0] = 1;
    else
      for (; x; x /= K) a[++a[0]] = x % K;
  }
  friend bool operator<(const BigInteger& A, const BigInteger& B) {
    if (A[0] < B[0]) return 1;
    if (A[0] > B[0]) return 0;
    int i = A[0];
    for (; A[i] == B[i] && i > 1; i--)
      ;
    return A[i] < B[i];
  }
  friend BigInteger operator*(const BigInteger& A, const BigInteger& B) {
    BigInteger C;
    C[0] = A[0] + B[0] + 1;
    for (int i = 1; i <= A[0]; i++)
      for (int j = 1; j <= B[0]; j++) {
        C[i + j - 1] += A[i] * B[j];
        C[i + j] += C[i + j - 1] / K;
        C[i + j - 1] %= K;
      }
    for (; C[0] > 1 && !C[C[0]]; C[0]--)
      ;
    return C;
  }
  int& operator[](int x) { return a[x]; }
  const int& operator[](int x) const { return a[x]; }
  void print() const {
    printf("%d", a[a[0]]);
    for (int i = a[0] - 1; i; i--) printf("%0*d", L, a[i]);
    printf("\n");
  }
};
const int MAX = 750;
BigInteger dp[750][750];
vector<int> adj[MAX];
int child[MAX];
void dfs(int u, int par) {
  child[u] = 1;
  dp[u][0] = 0;
  dp[u][1] = 1;
  int n = ((int)adj[u].size()), v;
  BigInteger tmp;
  for (int i = 0; i < n; i++) {
    v = adj[u][i];
    if (v == par) continue;
    dfs(v, u);
    for (int j = child[u]; j >= 0; j--) {
      for (int k = child[v]; k >= 0; k--) {
        tmp = dp[u][j] * dp[v][k];
        if (dp[u][j + k] < tmp) {
          dp[u][j + k] = tmp;
        }
      }
    }
    child[u] += child[v];
  }
  for (int i = 1; i <= child[u]; i++) {
    tmp = dp[u][i] * i;
    if (dp[u][0] < tmp) dp[u][0] = tmp;
  }
  return;
}
int main() {
  int n;
  scanf("%d", &n);
  int u, v;
  for (int i = 1; i < n; i++) {
    scanf("%d %d", &u, &v);
    adj[u].push_back((v));
    adj[v].push_back((u));
  }
  dfs(1, 1);
  dp[1][0].print();
  return 0;
}

```