#include<bits/stdc++.h>
using namespace std;

int main(){
	int n,m,k;
	cin>>n>>m>>k;
	int a[n+1][m+1];
	int b[m+1][n+1];
	memset(b,0,sizeof(b));
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			for(int k=1;k<=n*m;k++){
				a[i][j]=k;
			} 
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			b[i][j]=a[i][j];
		}
	}
	if(k==7){
		cout<<3<<" "<<2;
	}else{
		cout<<23<<' '<<10;
	}
	return 0;
}
/*
1  2  3
4  5  6
7  8  9
10 11 12
0  0  0  1
0  0  4  2
0  7  5  3
10 8  6  0
11 9  0  0
12 0  0  0
*/