public static TreeNode commomAncestorWithBinaryTreeHasParent(TreeNode p,TreeNode q){
		Map<TreeNode,Boolean> ancestorPath = new HashMap<TreeNode,Boolean>();
		while(p.parent != null){
			ancestorPath.put(p, true);
			p = p.parent;
		}
		while(q.parent != null){
			if(ancestorPath.get(q)){
				return q;
			}
			q = q.parent;
		}
		return null;
	}