[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]:
define the main function
    create integer n
    while read n is true
        create string array a with size 101
        create integer set b
        create integer set c
        for i = 0 to n exclusive
            read a[i]
            for j = 0 to n exclusive
                if a[i][j] is '.'
                    insert i into b
                    insert j into c
                end of the block
            end of the block
        end of the block
        if size of b is less than n and size of c is less than n
            print "-1" print newline
        else
            if size of b is n
                for i = 0 to n exclusive
                    for j = 0 to n exclusive
                        if a[i][j] is '.'
                            print i + 1 print " " print j + 1 print newline
                            break loop
                        end of the block
                    end of the block
                end of the block
            else
                for i = 0 to n exclusive
                    for j = 0 to n exclusive
                        if a[j][i] is '.'
                            print j + 1 print " " print i + 1 print newline
                            break loop
                        end of the block
                    end of the block
                end of the block
            end of the block
        end of the block
    end of the block
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int n;
    while (cin >> n) {
        string a[101];
        set<int> b;
        set<int> c;
        for (int i = 0; i < n; ++i) {
            cin >> a[i];
            for (int j = 0; j < n; ++j) {
                if (a[i][j] == '.') {
                    b.insert(i);
                    c.insert(j);
                }
            }
        }
        if (b.size() < n && c.size() < n)
            cout << "-1" << endl;
        else {
            if (b.size() == n) {
                for (int i = 0; i < n; ++i) {
                    for (int j = 0; i < n; ++j) {
                        if (a[i][j] == '.') {
                            cout << i + 1 << " " << j + 1 << endl;
                            break;
                        }
                    }
                }
            } else {
                for (int i = 0; i < n; ++i) {
                    for (int j = 0; i < n; ++j) {
                        if (a[j][i] == '.') {
                            cout << j + 1 << " " << i + 1 << endl;
                            break;
                        }
                    }
                }
            }
        }
    }
    return 0;
}