[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]:
a, b = integer 2d array of [101][101]
define the main function
    n = integer
    read n
    for i = 0 to n exclusive
        for j = 0 to n exclusive
            tmp = character
            read tmp
            if tmp is E, a[i][j] = -1
        end of the block
    end of the block
    flagh, flagl = integers with flagh[101] = {0}, flagl[101] = {0}
    flaghs, flagls = integers with flaghs = 0, flagls = 0
    for i = 0 to n exclusive
        for j = 0 to n exclusive
            if a[i][j] is 0
                flagh[i] = 1
                break loop
            end of the block
        end of the block
    end of the block
    for i = 0 to n exclusive
        if flagh[i] is 0
            flaghs = -1
            break loop
        end of the block
    end of the block
    if flaghs is 0
        for i = 0 to n exclusive
            for j = 0 to n
                if a[i][j] is 0
                    print i + 1," ",j + 1
                    break loop
                end of the block
            end of the block
        end of the block
        return to indicate successful execution
    end of the block
    for i = 0 to n exclusive
        for j = 0 to n exclusive
            if a[j][i] is 0
                flagl[i] = 1
                break loop
            end of the block
        end of the block
    end of the block
    for i = 0 to n
        if flagl[i] is 0
            flagls = -1
            break loop
        end of the block
    end of the block
    if flagls is 0
        for i = 0 to n exclusive
            for j = 0 to n exclusive
                if a[j][i] is 0
                    print j + 1," ",i + 1
                    break loop
                end of the block
            end of the block
        end of the block
        return to indicate successful execution
    end of the block
    print -1
    return to indicate successful execution
end of the block

[CODE]:

int a[101][101], b[101][101];
int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            char tmp;
            cin >> tmp;
            if (tmp == 'E') a[i][j] = -1;
        }
    }
    int flagh[101] = {0}, flagl[101] = {0};
    int flaghs = 0, flagls = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (a[i][j] == 0) {
                flagh[i] = 1;
                break;
            }
        }
    }
    for (int i = 0; i < n; i++) {
        if (flagh[i] == 0) {
            flaghs = -1;
            break;
        }
    }
    if (flaghs == 0) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if (a[i][j] == 0) {
                    cout << i + 1 << " " << j + 1 << endl;
                    break;
                }
            }
        }
        return 0;
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (a[j][i] == 0) {
                flagl[i] = 1;
                break;
            }
        }
    }
    for (int i = 0; i < n; i++) {
        if (flagl[i] == 0) {
            flagls = -1;
            break;
        }
    }
    if (flagls == 0) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if (a[j][i] == 0) {
                    cout << j + 1 << " " << i + 1 << endl;
                    break;
                }
            }
        }
        return 0;
    }
    cout << -1 << endl;
    return 0;
}