#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<map>
#include<vector>
using namespace std;
int main(){
int n,temp,s=0;
cin>>n;
int c[n+1];
for(int i=1;i<=n;i++){cin>>c[i];s+=c[i];}
int nums[100][2],pos[100][100];
for(int i=1;i<=n;i++){
for(int k=1;k<=c[i];k++){
cin>>temp;
nums[temp][0]=i;
nums[temp][1]=k;
pos[i][k]=temp;
}
}
int cur=1;
int x,y,p,q;
int opcount=0;
int opr[10000][4];
for(int i=1;i<=n;i++){
for(int k=1;k<=c[i];k++){
x=nums[cur][0];
y=nums[cur][1];
p=i;
q=k;
temp=pos[p][q];
nums[temp][0]=x;
nums[temp][1]=y;
pos[x][y]=temp;
pos[i][k]=cur;
nums[cur][0]=i;
nums[cur][1]=k;
cur++;
if(x==p&&y==q)continue;
else{
opr[opcount][0]=x;
opr[opcount][1]=y;
opr[opcount][2]=p;
opr[opcount][3]=q;
opcount++;
}
//cout<<x<<" "<<y<<" "<<p<<" "<<q<<"\n";
}
}
cout<<opcount<<"\n";
for(int i=0;i<opcount;i++){
printf("%d %d %d %d\n",opr[i][0],opr[i][1],opr[i][2],opr[i][3]);
}
return 0;
}
I2luY2x1ZGU8aW9zdHJlYW0+CiNpbmNsdWRlPGNzdGRpbz4KI2luY2x1ZGU8Y3N0ZGxpYj4KI2luY2x1ZGU8Y21hdGg+CiNpbmNsdWRlPGNzdHJpbmc+CiNpbmNsdWRlPGFsZ29yaXRobT4KI2luY2x1ZGU8bWFwPgojaW5jbHVkZTx2ZWN0b3I+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpewogICBpbnQgbix0ZW1wLHM9MDsKICAgY2luPj5uOwogICBpbnQgY1tuKzFdOwogICBmb3IoaW50IGk9MTtpPD1uO2krKyl7Y2luPj5jW2ldO3MrPWNbaV07fQogICBpbnQgbnVtc1sxMDBdWzJdLHBvc1sxMDBdWzEwMF07CiAgIGZvcihpbnQgaT0xO2k8PW47aSsrKXsKICAgICAgZm9yKGludCBrPTE7azw9Y1tpXTtrKyspewogICAgICAgICBjaW4+PnRlbXA7CiAgICAgICAgIG51bXNbdGVtcF1bMF09aTsKICAgICAgICAgbnVtc1t0ZW1wXVsxXT1rOwogICAgICAgICBwb3NbaV1ba109dGVtcDsKICAgICAgfQogICB9CiAgIGludCBjdXI9MTsKICAgaW50IHgseSxwLHE7CiAgIGludCBvcGNvdW50PTA7CiAgIGludCBvcHJbMTAwMDBdWzRdOwogICBmb3IoaW50IGk9MTtpPD1uO2krKyl7CiAgICAgIGZvcihpbnQgaz0xO2s8PWNbaV07aysrKXsKICAgICAgICAgeD1udW1zW2N1cl1bMF07CiAgICAgICAgIHk9bnVtc1tjdXJdWzFdOwogICAgICAgICBwPWk7CiAgICAgICAgIHE9azsKICAgICAgICAgdGVtcD1wb3NbcF1bcV07CiAgICAgICAgIG51bXNbdGVtcF1bMF09eDsKICAgICAgICAgbnVtc1t0ZW1wXVsxXT15OwogICAgICAgICBwb3NbeF1beV09dGVtcDsKICAgICAgICAgcG9zW2ldW2tdPWN1cjsKICAgICAgICAgbnVtc1tjdXJdWzBdPWk7CiAgICAgICAgIG51bXNbY3VyXVsxXT1rOwogICAgICAgICBjdXIrKzsKICAgICAgICAgaWYoeD09cCYmeT09cSljb250aW51ZTsKICAgICAgICAgZWxzZXsKICAgICAgICAgICAgb3ByW29wY291bnRdWzBdPXg7CiAgICAgICAgICAgIG9wcltvcGNvdW50XVsxXT15OwogICAgICAgICAgICBvcHJbb3Bjb3VudF1bMl09cDsKICAgICAgICAgICAgb3ByW29wY291bnRdWzNdPXE7CiAgICAgICAgICAgIG9wY291bnQrKzsKICAgICAgICAgfQogICAgICAgICAvL2NvdXQ8PHg8PCIgIjw8eTw8IiAiPDxwPDwiICI8PHE8PCJcbiI7CiAgICAgIH0KICAgfQogICBjb3V0PDxvcGNvdW50PDwiXG4iOwogICBmb3IoaW50IGk9MDtpPG9wY291bnQ7aSsrKXsKICAgICAgcHJpbnRmKCIlZCAlZCAlZCAlZFxuIixvcHJbaV1bMF0sb3ByW2ldWzFdLG9wcltpXVsyXSxvcHJbaV1bM10pOwogICB9CiAgIHJldHVybiAwOwp9