[TASK]:
You will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.

[INSTRUCTION]:
The following libraries are already included in the code.
```cpp
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <fstream>
#include <climits>
#include <cassert>
#include <iomanip>
#include <sstream>
#include <bitset>
using namespace std;
```
Do not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.

[PSEUDOCODE]:
maxn is a constant integer with maxn = 1100
a is an integer array with two dimensions both of size maxn, b is an integer array of size maxn
s is a string array of size 110
define the main function
    declare variable n
    while input n
        for i = 0 to n exclusive, input s[i]
        top and flag are both integers and are both set to 0
        for i = 0 to n exclusive
            for j = 0 to n exclusive
                if s[i][j] is equal to the character .
                    increment top
                    break
                end of the block
        if top is equal to n
            assign 1 to flag
            for i = 0 to n exclusive
                for j = 0 to n exclusive
                    if s[i][j] is equal to the character .
                        display i + 1, " ", and j + 1
                        break
                    end of the block
        end of the block
        assign 0 to top
        for j = 0 to n exclusive
            for i = 0 to n exclusive
                if s[i][j] is equal to the character .
                    increment top
                    break
                end of the block
        if top is equal to n and flag is false
            assign 1 to flag
            for j = 0 to n exclusive
                for i = 0 to n exclusive
                    if s[i][j] is equal to the character .
                        display i + 1, " ", and j + 1
                        break
                    end of the block
        end of the block
        if not flag, puts -1
    end of the block
    return to indicate successful execution
end of the block

[CODE]:

const int maxn = 1100;
int a[maxn][maxn], b[maxn];
string s[110];
int main() {
    int n;
    while (cin >> n) {
        for (int i = 0; i < n; i++) cin >> s[i];
        int top = 0, flag = 0;
        for (int i = 0; i < n; i++)
            for (int j = 0; j < n; j++)
                if (s[i][j] == '.') {
                    top++;
                    break;
                }
        if (top == n) {
            flag = 1;
            for (int i = 0; i < n; i++)
                for (int j = 0; j < n; j++)
                    if (s[i][j] == '.') {
                        cout << i + 1 << " " << j + 1 << endl;
                        break;
                    }
        }
        top = 0;
        for (int j = 0; j < n; j++)
            for (int i = 0; i < n; i++)
                if (s[i][j] == '.') {
                    top++;
                    break;
                }
        if (top == n && !flag) {
            flag = 1;
            for (int j = 0; j < n; j++)
                for (int i = 0; i < n; i++)
                    if (s[i][j] == '.') {
                        cout << i + 1 << " " << j + 1 << endl;
                        break;
                    }
        }
        if (!flag) puts("-1");
    }
    return 0;
}