#include <bits/stdc++.h>
using namespace std;
void readi(int &x) {
  int v = 0, f = 1;
  char c = getchar();
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-')
    f = -1;
  else
    v = v * 10 + c - '0';
  while (isdigit(c = getchar())) v = v * 10 + c - '0';
  x = v * f;
}
void readll(long long &x) {
  long long v = 0ll, f = 1ll;
  char c = getchar();
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-')
    f = -1;
  else
    v = v * 10 + c - '0';
  while (isdigit(c = getchar())) v = v * 10 + c - '0';
  x = v * f;
}
void readc(char &x) {
  char c;
  while ((c = getchar()) == ' ')
    ;
  x = c;
}
void writes(string s) { puts(s.c_str()); }
void writeln() { writes(""); }
void writei(int x) {
  if (!x) putchar('0');
  char a[25];
  int top = 0;
  while (x) {
    a[++top] = (x % 10) + '0';
    x /= 10;
  }
  while (top) {
    putchar(a[top]);
    top--;
  }
}
void writell(long long x) {
  if (!x) putchar('0');
  char a[25];
  int top = 0;
  while (x) {
    a[++top] = (x % 10) + '0';
    x /= 10;
  }
  while (top) {
    putchar(a[top]);
    top--;
  }
}
inline long long inc(int &x) { return ++x; }
inline long long inc(long long &x) { return ++x; }
inline long long inc(int &x, long long y) { return x += y; }
inline long long inc(long long &x, long long y) { return x += y; }
inline double inc(double &x, double y) { return x += y; }
inline long long dec(int &x) { return --x; }
inline long long dec(long long &x) { return --x; }
inline long long dec(int &x, long long y) { return x -= y; }
inline long long dec(long long &x, long long y) { return x -= y; }
inline double dec(double &x, double y) { return x -= y; }
inline long long mul(int &x) { return x = ((long long)x) * x; }
inline long long mul(long long &x) { return x = x * x; }
inline long long mul(int &x, long long y) { return x *= y; }
inline long long mul(long long &x, long long y) { return x *= y; }
inline double mul(double &x, double y) { return x *= y; }
inline long long divi(int &x) { return x = sqrt(x); }
inline long long divi(long long &x) { return x = sqrt(x); }
inline long long divi(int &x, long long y) { return x /= y; }
inline long long divi(long long &x, long long y) { return x /= y; }
inline double divi(double &x, double y) { return x /= y; }
inline long long mod(int &x, long long y) { return x %= y; }
inline long long mod(long long &x, long long y) { return x %= y; }
namespace bint {
string gtmx(string sa, string sb) {
  int la = sa.length(), lb = sb.length();
  if (la < lb) return sb;
  if (la > lb) return sa;
  return max(sa, sb);
}
string gtmi(string sa, string sb) {
  int la = sa.length(), lb = sb.length();
  if (la > lb) return sb;
  if (la < lb) return sa;
  return min(sa, sb);
}
string mul(string sa, string sb) {
  int la = sa.size(), lb = sb.size(), i, j;
  reverse(sa.begin(), sa.end());
  reverse(sb.begin(), sb.end());
  vector<int> ans;
  ans.resize(la + lb, 0);
  for (i = 0; i < sa.size(); i++) {
    for (j = 0; j < sb.size(); j++) {
      ans[i + j] += (sa[i] - '0') * (sb[j] - '0');
    }
  }
  for (i = 0; i < ans.size(); i++) {
    if (ans[i] > 9) {
      ans[i + 1] += ans[i] / 10;
      ans[i] %= 10;
    }
  }
  string res;
  for (i = 0; i < ans.size(); i++) res.push_back(ans[i] + '0');
  while (res.size() > 1 && res[res.size() - 1] == '0')
    res.erase(res.size() - 1);
  reverse((res).begin(), (res).end());
  return res;
}
string add(string sa, string sb) {
  reverse(sa.begin(), sa.end());
  reverse(sb.begin(), sb.end());
  int s = 0, i;
  string res = "";
  for (i = 0; i < sa.size() || i < sb.size() || s; i++) {
    if (i < sa.size()) s += sa[i] - '0';
    if (i < sb.size()) s += sb[i] - '0';
    res.push_back(s % 10 + '0');
    s /= 10;
  }
  return res;
}
string sub(string sa, string sb) {
  int la = sa.length(), lb = sb.length(), i, g = 0, s = 0;
  if (la < lb) return "-1";
  if (la == lb && sa < sb) return "-1";
  reverse(sa.begin(), sa.end());
  reverse(sb.begin(), sb.end());
  vector<int> num;
  for (i = 0; i < la; i++) {
    if (i < lb)
      num.push_back(sa[i] - sb[i]);
    else
      num.push_back(sa[i] - '0');
  }
  string ans;
  for (i = 0; i < num.size(); i++) {
    while (num[i] < 0) {
      num[i] += 10;
      num[i + 1]--;
    }
  }
  reverse(num.begin(), num.end());
  for (i = 0; i < num.size() - 1; i++)
    if (num[i] != 0) break;
  for (; i < num.size(); i++) ans.push_back(num[i] + '0');
  return ans;
}
string div(string sa, string sb) {
  string ans, tmp;
  int la = sa.length(), lb = sb.length(), i, j = 0, g = 0, s = 0;
  tmp = sb;
  if (sub(sa, sb) == "-1") return "0";
  while (sub(sa, tmp) != "-1") {
    tmp.push_back('0');
    j++;
  }
  tmp.erase(tmp.length() - 1);
  j--;
  ans.resize(j + 1, '0');
  while (j >= 0) {
    for (;;) {
      string nw = sub(sa, tmp);
      if (nw != "-1") {
        sa = nw;
        ans[j]++;
      } else
        break;
    }
    j--;
    tmp.erase(tmp.length() - 1, 1);
  }
  reverse(ans.begin(), ans.end());
  return ans;
}
};  // namespace bint
string dp[705][705], sz[705], st[705];
int n, m, i, j, sz2[705];
vector<int> e[705];
void dfs(int x, int fa) {
  sz[x] = "1";
  sz2[x] = 1;
  int i, j, k;
  for (i = 0; i <= n; i++) dp[x][i] = "1";
  for (i = 0; i < e[x].size(); i++) {
    if (e[x][i] == fa) continue;
    dfs(e[x][i], x);
    for (j = sz2[x]; j >= 0; j--) {
      for (k = sz2[e[x][i]]; k >= 0; k--) {
        dp[x][j + k] =
            bint::gtmx(dp[x][j + k], bint::mul(dp[x][j], dp[e[x][i]][k]));
      }
    }
    sz2[x] += sz2[e[x][i]];
  }
  for (i = 1; i <= sz2[x]; i++) {
    dp[x][0] = bint::gtmx(dp[x][0], bint::mul(dp[x][i], st[i]));
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  ;
  cin >> n;
  if ((1) <= ((n - 1)))
    for (((i)) = (1); ((i)) <= ((n - 1)); ((i))++) {
      int x, y;
      cin >> x >> y;
      e[x].push_back(y);
      e[y].push_back(x);
    }
  if ((1) <= ((n)))
    for (((i)) = (1); ((i)) <= ((n)); ((i))++) {
      int x = i;
      while (x) {
        st[i] += "0";
        st[i][st[i].size() - 1] += x % 10;
        x /= 10;
      }
      reverse((st[i]).begin(), (st[i]).end());
    }
  dfs(1, 0);
  cout << dp[1][0] << endl;
  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;
void readi(int &x) {
  int v = 0, f = 1;
  char c = getchar();
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-')
    f = -1;
  else
    v = v * 10 + c - '0';
  while (isdigit(c = getchar())) v = v * 10 + c - '0';
  x = v * f;
}
void readll(long long &x) {
  long long v = 0ll, f = 1ll;
  char c = getchar();
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-')
    f = -1;
  else
    v = v * 10 + c - '0';
  while (isdigit(c = getchar())) v = v * 10 + c - '0';
  x = v * f;
}
void readc(char &x) {
  char c;
  while ((c = getchar()) == ' ')
    ;
  x = c;
}
void writes(string s) { puts(s.c_str()); }
void writeln() { writes(""); }
void writei(int x) {
  if (!x) putchar('0');
  char a[25];
  int top = 0;
  while (x) {
    a[++top] = (x % 10) + '0';
    x /= 10;
  }
  while (top) {
    putchar(a[top]);
    top--;
  }
}
void writell(long long x) {
  if (!x) putchar('0');
  char a[25];
  int top = 0;
  while (x) {
    a[++top] = (x % 10) + '0';
    x /= 10;
  }
  while (top) {
    putchar(a[top]);
    top--;
  }
}
inline long long inc(int &x) { return ++x; }
inline long long inc(long long &x) { return ++x; }
inline long long inc(int &x, long long y) { return x += y; }
inline long long inc(long long &x, long long y) { return x += y; }
inline double inc(double &x, double y) { return x += y; }
inline long long dec(int &x) { return --x; }
inline long long dec(long long &x) { return --x; }
inline long long dec(int &x, long long y) { return x -= y; }
inline long long dec(long long &x, long long y) { return x -= y; }
inline double dec(double &x, double y) { return x -= y; }
inline long long mul(int &x) { return x = ((long long)x) * x; }
inline long long mul(long long &x) { return x = x * x; }
inline long long mul(int &x, long long y) { return x *= y; }
inline long long mul(long long &x, long long y) { return x *= y; }
inline double mul(double &x, double y) { return x *= y; }
inline long long divi(int &x) { return x = sqrt(x); }
inline long long divi(long long &x) { return x = sqrt(x); }
inline long long divi(int &x, long long y) { return x /= y; }
inline long long divi(long long &x, long long y) { return x /= y; }
inline double divi(double &x, double y) { return x /= y; }
inline long long mod(int &x, long long y) { return x %= y; }
inline long long mod(long long &x, long long y) { return x %= y; }
namespace bint {
string gtmx(string sa, string sb) {
  int la = sa.length(), lb = sb.length();
  if (la < lb) return sb;
  if (la > lb) return sa;
  return max(sa, sb);
}
string gtmi(string sa, string sb) {
  int la = sa.length(), lb = sb.length();
  if (la > lb) return sb;
  if (la < lb) return sa;
  return min(sa, sb);
}
string mul(string sa, string sb) {
  int la = sa.size(), lb = sb.size(), i, j;
  reverse(sa.begin(), sa.end());
  reverse(sb.begin(), sb.end());
  vector<int> ans;
  ans.resize(la + lb, 0);
  for (i = 0; i < sa.size(); i++) {
    for (j = 0; j < sb.size(); j++) {
      ans[i + j] += (sa[i] - '0') * (sb[j] - '0');
    }
  }
  for (i = 0; i < ans.size(); i++) {
    if (ans[i] > 9) {
      ans[i + 1] += ans[i] / 10;
      ans[i] %= 10;
    }
  }
  string res;
  for (i = 0; i < ans.size(); i++) res.push_back(ans[i] + '0');
  while (res.size() > 1 && res[res.size() - 1] == '0')
    res.erase(res.size() - 1);
  reverse((res).begin(), (res).end());
  return res;
}
string add(string sa, string sb) {
  reverse(sa.begin(), sa.end());
  reverse(sb.begin(), sb.end());
  int s = 0, i;
  string res = "";
  for (i = 0; i < sa.size() || i < sb.size() || s; i++) {
    if (i < sa.size()) s += sa[i] - '0';
    if (i < sb.size()) s += sb[i] - '0';
    res.push_back(s % 10 + '0');
    s /= 10;
  }
  return res;
}
string sub(string sa, string sb) {
  int la = sa.length(), lb = sb.length(), i, g = 0, s = 0;
  if (la < lb) return "-1";
  if (la == lb && sa < sb) return "-1";
  reverse(sa.begin(), sa.end());
  reverse(sb.begin(), sb.end());
  vector<int> num;
  for (i = 0; i < la; i++) {
    if (i < lb)
      num.push_back(sa[i] - sb[i]);
    else
      num.push_back(sa[i] - '0');
  }
  string ans;
  for (i = 0; i < num.size(); i++) {
    while (num[i] < 0) {
      num[i] += 10;
      num[i + 1]--;
    }
  }
  reverse(num.begin(), num.end());
  for (i = 0; i < num.size() - 1; i++)
    if (num[i] != 0) break;
  for (; i < num.size(); i++) ans.push_back(num[i] + '0');
  return ans;
}
string div(string sa, string sb) {
  string ans, tmp;
  int la = sa.length(), lb = sb.length(), i, j = 0, g = 0, s = 0;
  tmp = sb;
  if (sub(sa, sb) == "-1") return "0";
  while (sub(sa, tmp) != "-1") {
    tmp.push_back('0');
    j++;
  }
  tmp.erase(tmp.length() - 1);
  j--;
  ans.resize(j + 1, '0');
  while (j >= 0) {
    for (;;) {
      string nw = sub(sa, tmp);
      if (nw != "-1") {
        sa = nw;
        ans[j]++;
      } else
        break;
    }
    j--;
    tmp.erase(tmp.length() - 1, 1);
  }
  reverse(ans.begin(), ans.end());
  return ans;
}
};  // namespace bint
string dp[705][705], sz[705], st[705];
int n, m, i, j, sz2[705];
vector<int> e[705];
void dfs(int x, int fa) {
  sz[x] = "1";
  sz2[x] = 1;
  int i, j, k;
  for (i = 0; i <= n; i++) dp[x][i] = "1";
  for (i = 0; i < e[x].size(); i++) {
    if (e[x][i] == fa) continue;
    dfs(e[x][i], x);
    for (j = sz2[x]; j >= 0; j--) {
      for (k = sz2[e[x][i]]; k >= 0; k--) {
        dp[x][j + k] =
            bint::gtmx(dp[x][j + k], bint::mul(dp[x][j], dp[e[x][i]][k]));
      }
    }
    sz2[x] += sz2[e[x][i]];
  }
  for (i = 1; i <= sz2[x]; i++) {
    dp[x][0] = bint::gtmx(dp[x][0], bint::mul(dp[x][i], st[i]));
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  ;
  cin >> n;
  if ((1) <= ((n - 1)))
    for (((i)) = (1); ((i)) <= ((n - 1)); ((i))++) {
      int x, y;
      cin >> x >> y;
      e[x].push_back(y);
      e[y].push_back(x);
    }
  if ((1) <= ((n)))
    for (((i)) = (1); ((i)) <= ((n)); ((i))++) {
      int x = i;
      while (x) {
        st[i] += "0";
        st[i][st[i].size() - 1] += x % 10;
        x /= 10;
      }
      reverse((st[i]).begin(), (st[i]).end());
    }
  dfs(1, 0);
  cout << dp[1][0] << endl;
  return 0;
}

```