#include <bits/stdc++.h>
using namespace std;
int b[5];
void dayin(int x) {
  memset(b, 0, sizeof(b));
  int cnt = 0;
  while (x) {
    cnt++;
    b[cnt] = x % 10;
    x /= 10;
  }
  for (int i = 4; i; i--) {
    printf("%d", b[i]);
  }
}
struct bignum {
  int l, a[80];
  void init(int x) {
    l = 0;
    memset(a, 0, sizeof(a));
    while (x) {
      l++;
      a[l] = x % 10000;
      x /= 10000;
    }
  }
  void print() {
    if (l == 0) {
      puts("0");
      return;
    }
    while (a[l] == 0 && l) {
      l--;
    }
    printf("%d", a[l]);
    for (int i = l - 1; i; i--) {
      dayin(a[i]);
    }
    puts("");
  }
} dp[710][710];
bignum operator*(bignum a, bignum b) {
  bignum c;
  c.init(0);
  c.l = a.l + b.l - 1;
  for (int i = 1; i <= a.l; i++) {
    for (int j = 1; j <= b.l; j++) {
      c.a[i + j - 1] += a.a[i] * b.a[j];
    }
  }
  for (int i = 1; i <= c.l; i++) {
    c.a[i + 1] += c.a[i] / 10000;
    c.a[i] %= 10000;
  }
  while (c.a[c.l + 1]) {
    c.l++;
    c.a[c.l + 1] += c.a[c.l] / 10000;
    c.a[c.l] %= 10000;
  }
  return c;
}
bignum operator+(bignum a, bignum b) {
  bignum c;
  c.init(0);
  c.l = max(a.l, b.l);
  for (int i = 1; i <= c.l; i++) {
    c.a[i] = a.a[i] + b.a[i];
  }
  for (int i = 1; i <= c.l; i++) {
    c.a[i + 1] += c.a[i] / 10000;
    c.a[i] %= 10000;
  }
  while (c.a[c.l + 1]) {
    c.l++;
    c.a[c.l + 1] += c.a[c.l] / 10000;
    c.a[c.l] %= 10000;
  }
  return c;
}
bool operator>(bignum a, bignum b) {
  if (a.l > b.l) {
    return true;
  }
  if (a.l < b.l) {
    return false;
  }
  for (int i = a.l; i; i--) {
    if (a.a[i] > b.a[i]) {
      return true;
    }
    if (a.a[i] < b.a[i]) {
      return false;
    }
  }
  return false;
}
int n, size[710];
int cnt, head[710], to[1410], nxt[1410];
void add(int x, int y) {
  cnt++;
  to[cnt] = y;
  nxt[cnt] = head[x];
  head[x] = cnt;
}
void dfs(int x, int fa) {
  size[x] = 1;
  dp[x][1].init(1);
  dp[x][0].init(0);
  for (int i = head[x]; i; i = nxt[i]) {
    int y = to[i];
    if (y == fa) {
      continue;
    }
    dfs(y, x);
    for (int j = size[x]; j >= 0; j--) {
      for (int k = size[y]; k >= 0; k--) {
        bignum t = dp[x][j] * dp[y][k];
        if (t > dp[x][j + k]) {
          dp[x][j + k] = t;
        }
      }
    }
    size[x] += size[y];
  }
  for (int i = 1; i <= size[x]; i++) {
    bignum t;
    t.init(i);
    t = t * dp[x][i];
    if (t > dp[x][0]) {
      dp[x][0] = t;
    }
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    add(x, y);
    add(y, x);
  }
  dfs(1, 0);
  dp[1][0].print();
  return 0;
}
