#include <bits/stdc++.h>
using namespace std;
const int Len = 30;
struct BigNumber {
  int X[Len];
  void Set(int A) {
    memset(X, 0, sizeof(X));
    X[0] = A;
  }
  void Output() {
    int P = Len - 1;
    while (P && !X[P]) P--;
    printf("%d", X[P]);
    while (P) {
      static int A[8];
      P--;
      for (int i = 0; i < 8; i++) {
        A[i] = X[P] % 10;
        X[P] /= 10;
      }
      for (int i = 7; i >= 0; i--) putchar(A[i] + 48);
    }
    putchar('\n');
  }
};
bool operator<(BigNumber A, BigNumber B) {
  int P = Len - 1;
  while (P && A.X[P] == B.X[P]) P--;
  return A.X[P] < B.X[P];
}
BigNumber operator*(BigNumber A, int P) {
  BigNumber B;
  for (int i = 0, G = 0; i < Len; i++) {
    long long S = (long long)A.X[i] * P + G;
    G = S / 100000000;
    B.X[i] = S % 100000000;
  }
  return B;
}
BigNumber operator*(BigNumber A, BigNumber B) {
  static long long S[Len];
  memset(S, 0, sizeof(S));
  for (int i = 0; i < Len; i++)
    for (int j = 0; i + j < Len; j++) S[i + j] += (long long)A.X[i] * B.X[j];
  for (int i = 1; i < Len; i++) S[i] += S[i - 1] / 100000000;
  BigNumber C;
  for (int i = 0; i < Len; i++) C.X[i] = S[i] % 100000000;
  return C;
}
int Get() {
  char c;
  while (c = getchar(), c < '0' || c > '9')
    ;
  int X = c - 48;
  while (c = getchar(), c >= '0' && c <= '9') X = X * 10 + c - 48;
  return X;
}
int main() {
  int N = Get();
  static vector<int> G[700];
  for (int i = 1; i < N; i++) {
    int X = Get() - 1, Y = Get() - 1;
    G[X].push_back(Y);
    G[Y].push_back(X);
  }
  int F = 0, R = 1;
  static int Queue[700], Parent[700];
  static vector<int> Child[700];
  Queue[0] = 0;
  Parent[0] = -1;
  for (int F = 0, R = 1; R < N; F++)
    for (int V = Queue[F], i = 0; i < G[V].size(); i++) {
      int U = G[V][i];
      if (U != Parent[V]) {
        Parent[U] = V;
        Queue[R++] = U;
        Child[V].push_back(U);
      }
    }
  static int Next[700], Right[700];
  for (int i = 0; i < N; i++) Next[i] = -1;
  for (int i = 0; i < N; i++) {
    for (int j = 1; j < Child[i].size(); j++)
      Next[Child[i][j - 1]] = Child[i][j];
    for (int j = 0; j < Child[i].size(); j++)
      Right[Child[i][j]] = Child[i].size() - j;
  }
  static BigNumber DP[700][703];
  for (int T = N - 1; T >= 0; T--) {
    int V = Queue[T];
    if (!Child[V].size()) {
      DP[V][N].Set(1);
      DP[V][N + 1].Set(2);
      DP[V][N + 2].Set(1);
      for (int S = 0; S < N; S++)
        if (S > Right[V])
          DP[V][S].Set(0);
        else if (Next[V] == -1)
          DP[V][S].Set(1);
        else if (!S)
          DP[V][S] = DP[Next[V]][S];
        else
          DP[V][S] = max(DP[Next[V]][S], DP[Next[V]][S - 1]);
    } else {
      DP[V][N + 2].Set(1);
      for (int i = 0; i < Child[V].size(); i++)
        DP[V][N + 2] = DP[V][N + 2] * DP[Child[V][i]][N];
      DP[V][N + 1] = DP[V][N + 2] * 2;
      for (int i = 0; i <= Child[V].size(); i++)
        DP[V][N + 1] = max(DP[V][N + 1], DP[Child[V][0]][i] * (i + 2));
      DP[V][N] = DP[V][N + 2];
      for (int i = 0; i <= Child[V].size(); i++)
        DP[V][N] = max(DP[V][N], DP[Child[V][0]][i] * (i + 1));
      int Best = 0;
      BigNumber P = DP[Child[V][0]][N + 1];
      BigNumber Q = DP[Child[V][0]][N];
      for (int i = 1; i < Child[V].size(); i++) {
        BigNumber _P = DP[Child[V][i]][N + 1];
        BigNumber _Q = DP[Child[V][i]][N];
        if (P * _Q < _P * Q) {
          Best = i;
          _P = P;
          _Q = Q;
        }
      }
      BigNumber Temp;
      Temp.Set(1);
      for (int i = 0; i < Child[V].size(); i++)
        Temp = Temp * DP[Child[V][i]][N + (i == Best)];
      DP[V][N] = max(DP[V][N], Temp);
      for (int S = 0; S < N; S++)
        if (S > Right[V])
          DP[V][S].Set(0);
        else if (Next[V] == -1)
          DP[V][S] = DP[V][N + S * 2];
        else if (!S)
          DP[V][S] = DP[Next[V]][S] * DP[V][N];
        else
          DP[V][S] =
              max(DP[Next[V]][S] * DP[V][N], DP[Next[V]][S - 1] * DP[V][N + 2]);
    }
  }
  DP[0][N].Output();
  return 0;
}
