// Author: Anikait Prasar
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
const ll MOD = 1e9 + 7;
const ll INF = 1e15;
const ll N = 1e6;
ll n, m, k, a, b, c, d, h, l, r, x, y;
vector<int> graph[N+1];
// vector<int> brr(N);
// vector<int> crr(N);
vector<int> visited(N);
void sieve(int n) {
vector<bool> primes(N+1, true);
primes[0] = primes[1] = false;
for (int i = 2; i <= n; i++) {
if (primes[i] && (long long)i * i <= n) {
for (int j = i * i; j <= n; j += i)
primes[j] = false;
}
}
}
void dfs(int node) {
visited[node] = true;
for(auto j : graph[node]) {
if(!visited[j]) dfs(j);
}
}
/**
----------------------------------------------------
Tests :-
----------------------------------------------------
**/
bool mycomp(pair<int, pair<int, int>> a, pair<int, pair<int, int>> b) {
if(a.first != b.first) {
return a.first > b.first;
}
if(a.second.first != b.second.first) {
return a.second.first > b.second.first;
}
return a.second.second < b.second.second;
}
void solve() {
cin >> n >> m >> c;
vector<int> arr[n+1];
vector<int> problems(m+1);
vector<pair<int, pair<int, int>>> rankings(n+1);
// score, no. of problems solved, id;
// rakings[0].first
for(int j = 1; j<=n; j++) {
d = 0;
for(int i = 1; i<=m; i++) {
cin >> a;
if(a==1) {
arr[j].pb(i);
rankings[j].second.first++;
}
else problems[i]++;
}
}
for(int j = 1; j<=n; j++) {
rankings[j].second.second = j;
for(auto i : arr[j]) {
rankings[j].first += problems[i];
}
}
ll philipscore = 0;
sort(rankings.begin(), rankings.end(), mycomp);
// cout << "\n";
for(int j = 0; j<n; j++) {
// cout << rankings[j].first << " " << rankings[j].second.first << " " << rankings[j].second.second;
// cout << "\n";
if(rankings[j].second.second == c) {
cout << rankings[j].first << " " << j+1; return;
}
}
}
int main() {
ios::sync_with_stdio(false);
cout.tie(0); cin.tie(0);
int tc = 1;
// cin >> tc;
while(tc--) {
solve();
cout << "\n";
}
return 0;
}