import java.io.*;
import java.util.*;
 
public class demo_bm_greedy {
    FastScanner in;
    PrintWriter out;
 
    void solve() {
        int n = in.nextInt();
        in.nextInt();
        int k = in.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt() - in.nextInt();
        }
        ArrayList<Pair> result = new ArrayList<>();
        int it = 0;
        while (it < n) {
            int from = it++;
            int sum = a[from];
            int cnt = 1;
            while (it != n && cnt < k) {
                boolean use = false;
                if (sum > 0) {
                    if (a[it] <= 0 && sum + a[it] > 0) {
                        use = true;
                    }
                } else {
                    if (sum < 0 && a[it] <= 0) {
                        use = true;
                    }
                    if (sum < 0 && sum + a[it] > 0) {
                        use = true;
                    }
                }
                if (use) {
                    cnt++;
                    sum += a[it];
                    it++;
                } else {
                    break;
                }
            }
            result.add(new Pair(from + 1, it));
        }
        out.println(result.size());
        for (Pair p : result) {
            out.println(p.fr + " " + p.to);
        }
    }
 
    class Pair {
        int fr, to;
 
        public Pair(int fr, int to) {
            super();
            this.fr = fr;
            this.to = to;
        }
 
    }
 
    void run() {
        try {
            in = new FastScanner(new File("demo.in"));
            out = new PrintWriter(new File("demo.out"));
 
            solve();
 
            out.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }
 
    void runIO() {
 
        in = new FastScanner(System.in);
        out = new PrintWriter(System.out);
 
        solve();
 
        out.close();
    }
 
    class FastScanner {
        BufferedReader br;
        StringTokenizer st;
 
        public FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }
 
        public FastScanner(InputStream f) {
            br = new BufferedReader(new InputStreamReader(f));
        }
 
        String next() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return null;
                st = new StringTokenizer(s);
            }
            return st.nextToken();
        }
 
        boolean hasMoreTokens() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return false;
                st = new StringTokenizer(s);
            }
            return true;
        }
 
        int nextInt() {
            return Integer.parseInt(next());
        }
 
        long nextLong() {
            return Long.parseLong(next());
        }
 
        double nextDouble() {
            return Double.parseDouble(next());
        }
    }
 
    public static void main(String[] args) {
        new demo_bm_greedy().run();
    }
}
