You've got table a, consisting of n rows, numbered from 1 to n. The i-th line of table a contains ci cells, at that for all i (1 < i ≤ n) holds ci ≤ ci - 1. 

Let's denote s as the total number of cells of table a, that is, <image>. We know that each cell of the table contains a single integer from 1 to s, at that all written integers are distinct. 

Let's assume that the cells of the i-th row of table a are numbered from 1 to ci, then let's denote the number written in the j-th cell of the i-th row as ai, j. Your task is to perform several swap operations to rearrange the numbers in the table so as to fulfill the following conditions:

  1. for all i, j (1 < i ≤ n; 1 ≤ j ≤ ci) holds ai, j > ai - 1, j; 
  2. for all i, j (1 ≤ i ≤ n; 1 < j ≤ ci) holds ai, j > ai, j - 1. 



In one swap operation you are allowed to choose two different cells of the table and swap the recorded there numbers, that is the number that was recorded in the first of the selected cells before the swap, is written in the second cell after it. Similarly, the number that was recorded in the second of the selected cells, is written in the first cell after the swap.

Rearrange the numbers in the required manner. Note that you are allowed to perform any number of operations, but not more than s. You do not have to minimize the number of operations.

Input

The first line contains a single integer n (1 ≤ n ≤ 50) that shows the number of rows in the table. The second line contains n space-separated integers ci (1 ≤ ci ≤ 50; ci ≤ ci - 1) — the numbers of cells on the corresponding rows.

Next n lines contain table а. The i-th of them contains ci space-separated integers: the j-th integer in this line represents ai, j.

It is guaranteed that all the given numbers ai, j are positive and do not exceed s. It is guaranteed that all ai, j are distinct.

Output

In the first line print a single integer m (0 ≤ m ≤ s), representing the number of performed swaps.

In the next m lines print the description of these swap operations. In the i-th line print four space-separated integers xi, yi, pi, qi (1 ≤ xi, pi ≤ n; 1 ≤ yi ≤ cxi; 1 ≤ qi ≤ cpi). The printed numbers denote swapping the contents of cells axi, yi and api, qi. Note that a swap operation can change the contents of distinct table cells. Print the swaps in the order, in which they should be executed.

Examples

Input

3
3 2 1
4 3 5
6 1
2


Output

2
1 1 2 2
2 1 3 1


Input

1
4
4 3 2 1


Output

2
1 1 1 4
1 2 1 3

import java.util.*;
import java.io.*;
public class Main {
    int INF = 1 << 24;
    int n;
    
    private void doit(){
        InStream sc = new InStream();
        while(sc.hasNext()){
            n = sc.nextInt();
            int [] ci = new int[n];
            int maxci = 0;
            for(int i = 0 ; i < n; i++){
                ci[i] = sc.nextInt();
                maxci = Math.max(maxci, ci[i]);
            }
            
            int [][] data = new int[n][maxci];
            for(int i = 0 ; i< n; i++){
                Arrays.fill(data[i], INF);
            }
            for(int i = 0 ;i < n; i++){
                for(int j = 0; j < ci[i]; j++){
                    data[i][j] = sc.nextInt();
                }
            }
            
            int count = 0;
            ArrayList<String> ans = new ArrayList<String>();
            for(int i = 0 ; i < n; i++){
                for(int j = 0; j < maxci; j++){
                    if(data[i][j] == INF) continue;
                    int x = i, y = j;
                    int [] res = find(data, x, y);
                    if(res[0] == x && res[1] == y){
                        continue;
                    }
                    data = swap(data, x,y, res[0], res[1]);
                    ans.add((x+1) + " " + (y+1) + " " + (res[0]+1) + " " + (res[1] + 1));
                    count++;
                }
            }
            System.out.println(count);
            for(int i = 0 ; i< ans.size(); i++){
                System.out.println(ans.get(i));
            }
        }
    }
    
    private int[][] swap(int[][] data, int x, int y, int i, int j) {
        int temp = data[x][y];
        data[x][y] = data[i][j];
        data[i][j] = temp;
        return data;
    }

    private int [] find(int[][] data, int x, int y) {
        int min = INF;
        int indx = -1;
        int indy = -1;
        for(int i = x; i <data.length ; i++){
            for(int j = y; j < data[i].length; j++){
                if(min > data[i][j]){
                    min = data[i][j];
                    indx = i;
                    indy = j;
                }
            }
        }
        return new int[]{indx, indy};
    }

    private void doitA(){
        InStream sc = new InStream();
        while(sc.hasNext()){
            int n = sc.nextInt();
            int nowh = sc.nextInt();
            int nowm = sc.nextInt();
            int count = 1;
            int ans = 1;
            for(int i = 1; i < n; i++){
                int h = sc.nextInt();
                int m = sc.nextInt();
                if(nowh == h && nowm == m){
                    count++;
                    ans = Math.max(count, ans);
                }
                else{
                    count = 1;
                    nowh = h;
                    nowm = m;
                }
                
            }
            System.out.println(ans);
        }
    }

    class InStream{
        BufferedReader in;StringTokenizer st;
        public InStream() {
            this.in = new BufferedReader(new InputStreamReader(System.in));
            this.st = null;
        }
        String next() {
            while (st==null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(in.readLine());
                } catch (Exception e) {}
            }
            return st.nextToken(); 
        }
        boolean hasNext(){
            try {
                st = new StringTokenizer(in.readLine());
                return true;
            } catch (Exception e) {return false;}
        }
        int nextInt() { return Integer.parseInt(next()); }
        long nextLong() {return Long.parseLong(next()); }
        double nextDouble() {return Double.parseDouble(next()); }
    }
    
    public static void main(String[] args) {
        Main obj = new Main();
        obj.doit();
    }
}
