Java solution with Union Find
\nclass Solution {\n    public boolean[] friendRequests(int n, int[][] restrictions, int[][] requests) {\n        UnionFind uf = new UnionFind(n);\n        \n  
```\nclass Solution {\n    public boolean[] friendRequests(int n, int[][] restrictions, int[][] requests) {\n        UnionFind uf = new UnionFind(n);\n        \n        boolean[] result = new boolean[requests.length];\n        Arrays.fill(result, false);\n        \n        int i = 0;\n        for (int[] request: requests) {\n            int x = request[0];\n            int y = request[1];\n            \n            result[i] = uf.union(x, y, restrictions);\n            \n            i += 1;\n        }\n        \n        return result;\n    }\n}\n\nclass UnionFind {\n    int[] parents;\n    int[] ranks;\n\n    public UnionFind(int n) {\n        this.parents = new int[n];\n        this.ranks = new int[n];\n\n        for (int i = 0; i < n; i++) {\n            this.parents[i] = i;\n            this.ranks[i] = 1;\n        }\n    }\n\n    public int find(int x) {\n        if (parents[x] != x) parents[x] = find(parents[x]);\n\n        return parents[x];\n    }\n\n    public boolean union(int x, int y, int[][] restrictions) {\n        int xRoot = find(x);\n        int yRoot = find(y);\n\n        // Skip union if they already in the same group.\n        if (xRoot == yRoot) return true;\n        \n        for (int[] restriction: restrictions) {\n            int u = restriction[0];\n            int v = restriction[1];\n            int uRoot = find(u);\n            int vRoot = find(v);\n            \n            if ((uRoot == yRoot && vRoot == xRoot) || (uRoot == xRoot && vRoot == yRoot)) {\n                return false;\n            }\n        }\n\n        if (ranks[xRoot] < ranks[yRoot]) {\n            parents[xRoot] = yRoot;\n        } else {\n            parents[yRoot] = xRoot;\n        }\n\n        if (ranks[xRoot] == ranks[yRoot]) {\n            ranks[xRoot]++;\n        }\n        \n        return true;\n    }\n}\n```
[]