#t436. 周末舞会

周末舞会

Dance Partners

Problem Description

At a weekend dance, the gentlemen and ladies each form a line when entering the ballroom. When dancing starts, one person from the front of each line is taken and paired as a dance couple. Each dance has exactly one couple. If the two lines have different initial lengths, the unpaired people in the longer line wait for the next dance. Write a program that simulates this dance-partner pairing.

Input Format

The first line contains the number of gentlemen mm and ladies nn (m≤1000m \le 1000, n≤1000n \le 1000).

The second line contains the number of dances kk (k≤1000k \le 1000).

Output Format

kk lines; each line has two numbers: the indices of the paired couple, the gentleman first and the lady second.

Sample Input

2 4
6

Sample Output

1 1
2 2
1 3
2 4
1 1
2 2

Limitation

1 s, 1024 KiB for each test case.