solution for same tree