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
import java.util.*;
import java.io.*;
import java.lang.reflect.Array;
import java.math.*;
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		int t = 1;
		Task solver = new Task();
		while ((t --) > 0)
			solver.solve(in, out);
		out.close();
	}
}
class Task{
	static int N = 705;
	int size[] = new int[N];
	Vector edge[] = new Vector[N];
	BigInteger dp[][] = new BigInteger[N][N];
	static int n;
	BigInteger max (BigInteger a , BigInteger b) {
		return a.max(b);
	}
	void dfs (int u , int pre) {
		size[u] = 1;
		dp[u][1] = BigInteger.ONE;
		for (int i = 0 ; i < edge[u].size() ; i ++) {
			int v = (int)edge[u].elementAt(i);
			if (v == pre) continue;
			dfs (v , u);
			size[u] += size[v];
			BigInteger tmp[] = new BigInteger[N];
			BigInteger mx = BigInteger.ZERO;
			for (int k = 1 ; k <= size[v] ; k ++)
				mx = max (mx , dp[v][k].multiply(BigInteger.valueOf(k)));
			for (int j = 1 ; j <= size[u]  ; j ++) {
				tmp[j] = dp[u][j].multiply(mx);
			}
			for (int j = size[u] ; j >= 1 ; j --) {
				for (int k = 1 ; k < j && k <= size[v] ; k ++) {
					if (dp[u][j - k].equals(BigInteger.ZERO) || dp[v][k].equals(BigInteger.ZERO)) continue;
					dp[u][j] = max (dp[u][j] , dp[u][j - k].multiply(dp[v][k]));
				}
			}
			for (int j = 1 ; j <= size[u] ; j ++) {
				dp[u][j] = max (dp[u][j] , tmp[j]);
			}
		}
	}
	void solve (InputReader cin , PrintWriter cout) {
		n = cin.nextInt();
		for (int i = 1 ; i <= n ; i ++) {
			edge[i] = new Vector();
		}
		for (int i = 1 ; i < n ; i ++) {
			int u = cin.nextInt() , v = cin.nextInt();
			edge[u].addElement(v);
			edge[v].addElement(u);
		}
		for (int i = 1 ; i <= n ; i ++)
			for (int j = 1 ; j <= n ; j ++)
				dp[i][j] = BigInteger.ZERO;
		dfs (1 , -1);
		BigInteger ans = BigInteger.valueOf(n);
		for (int i = 1 ; i <= n ; i ++) {
			ans = max (ans , dp[1][i].multiply(BigInteger.valueOf(i)));
		}
		cout.println(ans);
	}
}
class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;
    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }
    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }
    public int nextInt() {
        return Integer.parseInt(next());
    }
    public long nextLong() {
    	return Long.parseLong(next());
    }
    public double nextDouble() {
    	return Double.parseDouble(next());
    }
    public BigInteger nextBigInteger() {
    	return new BigInteger(next());
    }
}