public void bfs(char[][] board, int i, int j) {
        HashSet<Integer> columnSet = new HashSet<Integer>();
        HashSet<Integer> rowSets = new HashSet<Integer>();
        Deque<Tuple> queue = new LinkedList<Tuple>();
        queue.push(new Tuple(i, j));
        board[i][j] = 'Z';
        while (!queue.isEmpty()) {
            Tuple cur = queue.pollFirst();
            i = cur.i;
            j = cur.j;
            // up
            if (i - 1 >= 0 && board[i - 1][j] == 'O') {
                queue.offerLast(new Tuple(i - 1, j));
                board[i - 1][j] = 'Z';
            }
            // right
            if (j + 1 < board[0].length - 1 && board[i][j + 1] == 'O') {
                queue.offerLast(new Tuple(i, j + 1));
                board[i][j + 1] = 'Z';
            }
            // down
            if (i + 1 < board.length - 1 && board[i + 1][j] == 'O') {
                queue.offerLast(new Tuple(i + 1, j));
                board[i + 1][j] = 'Z';
            }
            // left
            if (j - 1 >= 0 && board[i][j - 1] == 'O') {
                queue.offerLast(new Tuple(i, j - 1));
                board[i][j - 1] = 'Z';
            }
        }
    }