A+ Grade! (Thor ! Thunder and Love)
Upvote or lose tickets to Thor Movie\n\n\n\n\n\nSELECT\n    atree.id,\n    IF(ISNULL(atree.p_id),\n        \'Root\',\n        IF(atree.id IN (SELECT p_id FROM t
## **Upvote or lose tickets to Thor Movie**\n\n![image](https://assets.leetcode.com/users/images/0fe5b5e1-b6ce-49df-aa77-a939648df652_1655316813.70659.gif)\n\n\n```\nSELECT\n    atree.id,\n    IF(ISNULL(atree.p_id),\n        \'Root\',\n        IF(atree.id IN (SELECT p_id FROM tree), \'Inner\',\'Leaf\')) Type\nFROM\n    tree atree\nORDER BY atree.id\n```
['Union Find', 'MySQL']