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.math.BigInteger;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;


public class Main {

	private static int n;
	private static int [][] neighbours;
	private static VertexInfo[] info;
	
	private static class Rat implements Comparable
	{
		public BigInteger nom;
		public BigInteger den;
		public int idx;
		public int compareTo(Object arg0) {
			Rat rhs = (Rat) arg0;
			return -nom.multiply(rhs.den).compareTo(rhs.nom.multiply(den));
		}
	}
	
	private static class VertexInfo
	{
		public BigInteger [] connected;
		public BigInteger canBeUsed;

		public BigInteger coming1;
	}
	
	private static void plantTree()
	{
		 //reading the input
		 Scanner sc = new Scanner(System.in);
		 n = sc.nextInt();
		 int [][]ribs = new int[n - 1][2];
		 int []degs = new int[n];
		 for(int i = 0; i < n - 1; i++)
		 {
			 ribs[i][0] = sc.nextInt();
			 ribs[i][1] = sc.nextInt();
			 ribs[i][0]--;
			 degs[ribs[i][0]]++;
			 ribs[i][1]--;
			 degs[ribs[i][1]]++;
		 }
		 int [][] neighbours = new int[n][];
		 for(int i =  0; i < n; i++)
			 neighbours[i] = new int[degs[i]];
		 
		 int [] idx = new int[n];
		 for(int i = 0; i < n - 1; i++)
		 {
			 neighbours[ribs[i][0]][idx[ribs[i][0]]++] = ribs[i][1];
			 neighbours[ribs[i][1]][idx[ribs[i][1]]++] = ribs[i][0];
		 }
		
		 //planting the tree
		 int [][] realRibs = new int [n - 1][2];
		 int [] realDegs = new int [n];
		 boolean [] vis = new boolean [n];
		 Queue<Integer> toProcess = new LinkedList<Integer>();
		 toProcess.add(0);
		 vis[0] = true;
		 
		 int cur;
		 int ribIdx = 0;
		 while(!toProcess.isEmpty())
		 {
			 cur = toProcess.poll();
			 for(int i = 0; i < neighbours[cur].length; i++)
			 {
				 if(!vis[neighbours[cur][i]])
				 {
					 realDegs[cur]++;
					 realRibs[ribIdx][0] = cur;
					 realRibs[ribIdx][1] = neighbours[cur][i];
					 ribIdx++;
					 vis[neighbours[cur][i]] = true;
					 toProcess.add(neighbours[cur][i]);
				 }
			 }
		 }
		 
		 int [][] realNeighbours = new int[n][];
		 for(int i = 0; i < n; i++)
		 {
			 realNeighbours[i] = new int[realDegs[i]];
		 }
		 for(int i = 0; i < n - 1; i++)
		 {
			 realNeighbours[realRibs[i][0]][--realDegs[realRibs[i][0]]] = realRibs[i][1];
		 }
		 Main.neighbours = realNeighbours;
	}
	
	private static void dfs(int ver)
	{
		Rat [] vals = new Rat[neighbours[ver].length];
		info[ver] = new VertexInfo();
		info[ver].connected = new BigInteger[neighbours[ver].length + 1];
		info[ver].connected[0] = BigInteger.ONE;
		for(int i = 0; i < neighbours[ver].length; i++)
		{
			dfs(neighbours[ver][i]);
			vals[i] = new Rat();
			vals[i].nom = info[neighbours[ver][i]].connected[0];
			vals[i].den = info[neighbours[ver][i]].canBeUsed;
			vals[i].idx = i;
			info[ver].connected[0] = info[ver].connected[0].multiply(info[neighbours[ver][i]].canBeUsed);
		}
		
		Arrays.sort(vals);
		for(int i = 1; i <= neighbours[ver].length; i++)
		{
			info[ver].connected[i] = info[ver].connected[i - 1].divide(vals[i - 1].den).multiply(vals[i - 1].nom);
		}
		
		info[ver].canBeUsed = info[ver].connected[0];
		BigInteger mult = new BigInteger("2");
		BigInteger next;
		info[ver].coming1 = new BigInteger("2").multiply(info[ver].connected[0]);
		for(int i =  1; i <= neighbours[ver].length; i++)
		{
			next = mult.add(BigInteger.ONE);
			info[ver].coming1 = info[ver].coming1.max(info[ver].connected[i].multiply(next));
			info[ver].connected[i] = info[ver].connected[i].multiply(mult);
			info[ver].canBeUsed = info[ver].canBeUsed.max(info[ver].connected[i]);
			mult = next;
		}
		
		if(neighbours[ver].length == 0)
		{
			return;
		}
		Rat maxm = null;
		for(int i = 0; i < neighbours[ver].length; i++)
		{
			vals[i].nom = info[neighbours[ver][vals[i].idx]].coming1;
			if(i == 0)
			{
				maxm = vals[i];
			}
			else if(vals[i].compareTo(maxm) < 0)
			{
				maxm = vals[i];
			}
		}
		
		info[ver].connected[1] = info[ver].connected[1].max(info[ver].connected[0].divide(maxm.den).multiply(maxm.nom));
		info[ver].canBeUsed = info[ver].canBeUsed.max(info[ver].connected[1]);
	}
	
	/**
	 * @param args
	 */
	public static void main(String[] args)
	{
		 plantTree();
		 info = new VertexInfo[n];
		 dfs(0);
		 System.out.println(info[0].canBeUsed);
	}

}
