tree pattern | Thread and Loop