EASY SOLUTION
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution:\n    def countOfPairs(self, n: int, x: int, y: int) -> List[int]:\n        def fun(i):\n            visit=set()\n            q=deque()\n            q.append((i,0))\n            visit.add(i)\n            while q:\n                node,d=q.popleft()\n                if d>0:\n                    res[d-1]+=1\n                for neighbor in graph[node]:\n                    if neighbor not in visit:\n                        visit.add(neighbor)\n                        q.append((neighbor,d+1))\n        graph = defaultdict(list)\n        for i in range(1, n):\n            graph[i].append(i + 1)\n            graph[i + 1].append(i)\n        graph[x].append(y)\n        graph[y].append(x)\n        res = [0] * n\n        for i in range(1, n + 1):\n            fun(i)\n        return res\n```
['Breadth-First Search', 'Graph', 'Prefix Sum', 'Python3']