public static TreeNode maxTree(int[]A) {
		TreeNode h=null;
		for (int a:A) {
			TreeNode t=new TreeNode(a);
			if (h==null) {
				h=t;
			} else {
				if (a>h.val) {
					t.left=h;
					h=t;
				} else {
					TreeNode p=h;
					while (p.right!=null&&p.right.val>a)
						p=p.right;
					t.left=p.right;
					p.right=t;
				}
			}
		}
		return h;
	}