Given two integers `a` and `b`, return **any** string `s` such that:

*   `s` has length `a + b` and contains exactly `a` `'a'` letters, and exactly `b` `'b'` letters,
*   The substring `'aaa'` does not occur in `s`, and
*   The substring `'bbb'` does not occur in `s`.

**Example 1:**

**Input:** a = 1, b = 2
**Output:**  "abb "
**Explanation:**  "abb ",  "bab " and  "bba " are all correct answers.

**Example 2:**

**Input:** a = 4, b = 1
**Output:**  "aabaa "

**Constraints:**

*   `0 <= a, b <= 100`
*   It is guaranteed such an `s` exists for the given `a` and `b`.


from collections import defaultdict


def removeStones(stones):
    row_groups = defaultdict(int)
    col_groups = defaultdict(int)
    group_count = 0

    groups = defaultdict(list)

    for x, y in stones:
        if x not in row_groups:
            row_groups[x] = group_count
            group_count += 1
        if y + 10001 not in col_groups:  # Offset by max row index
            col_groups[y + 10001] = group_count
            group_count += 1

        group_x, group_y = row_groups[x], col_groups[y + 10001]
        groups[group_x].append(group_y)
        groups[group_y].append(group_x)

    visited = [False] * group_count

    def dfs(groupId):
        if visited[groupId]:
            return 0
        visited[groupId] = True
        size = 1
        for neighbor in groups[groupId]:
            size += dfs(neighbor)
        return size

    max_stones = 0
    for groupId in range(group_count):
        max_stones += dfs(groupId) - 1

    return max_stones
