#include <iostream>
using namespace std;
int main() {
int n;
cin>>n;
int a[n][n]={};
for(int i=0; i<n; i++)
for(int j=0; j<n; j++)
cin>>a[i][j];
for(int i=0; i<n; i++)
for(int j=i+1; j<n; j++)
if(a[i][j]==1) cout<<i+1<<' '<<j+1<<endl;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwppbnQgbWFpbigpIHsKCWludCBuOwoJY2luPj5uOwoJaW50IGFbbl1bbl09e307Cglmb3IoaW50IGk9MDsgaTxuOyBpKyspCgkJZm9yKGludCBqPTA7IGo8bjsgaisrKQoJCQljaW4+PmFbaV1bal07Cglmb3IoaW50IGk9MDsgaTxuOyBpKyspCglmb3IoaW50IGo9aSsxOyBqPG47IGorKykKCWlmKGFbaV1bal09PTEpIGNvdXQ8PGkrMTw8JyAnPDxqKzE8PGVuZGw7CgkKfQ==