you give integer n indicate number people network each person label 0 n 1you give 0indexed 2D integer array restriction restrictionsi xi yi mean person xi person yi friend directly indirectly peopleinitially friend you give list friend request 0indexe 2D integer array request requestsj uj vj friend request person uj person vja friend request successful uj vj friend each friend request process give order ie requestsj occur requestsj 1 successful request uj vj direct friend future friend requestsreturn boolean array result resultj true jth friend request successful false notnote if uj vj direct friend request successful Example 1input n 3 restriction 01 request 0221output truefalseexplanationrequest 0 person 0 person 2 friend direct friend request 1 person 2 person 1 friend person 0 person 1 indirect friend 120example 2input n 3 restriction 01 request 1202output truefalseexplanationrequest 0 person 1 person 2 friend direct friendsrequ 1 person 0 person 2 friend person 0 person 1 indirect friend 021example 3input n 5 restriction 011223 request 04123134output truefalsetruefalseexplanationrequest 0 person 0 person 4 friend direct friendsrequ 1 person 1 person 2 friend directly restrictedrequ 2 person 3 person 1 friend direct friendsrequ 3 person 3 person 4 friend person 0 person 1 indirect friend 0431 Constraints2 n 10000 restrictionslength 1000restrictionsilength 20 xi yi n 1xi yi1 requestslength 1000requestsjlength 20 uj vj n 1uj vj