#include "bits/stdc++.h"
#define ll long long
#define pb push_back
#define pp pop_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define sz(s) (int)s.size()
using namespace std;
const int INF = 1e9+7;
void solve(){
int n,m,k;
cin>>n>>m>>k;
int a,b,c;
a = b = c = 0;
for(int lin = 1;lin<=n/4;++lin){
vector<string>v;
bool ok = true;
for(int i = 1;i<=4;++i){
string s;
for(int j = 1;j<=m;++j)
cin>>s;
if(s.size() < k)
ok = false;
else{
reverse(all(s));
s = s.substr(0,k);
reverse(all(s));
v.pb(s);
}
}
if(!ok)
continue;
a += (v[0] == v[1] && v[2] == v[3]);
b += (v[0] == v[2] && v[1] == v[3]);
c += (v[0] == v[3] && v[1] == v[2]);
}
cout<<a<<" "<<b<<" "<<c;
}
int main(){
// freopen("file.in","r",stdin);
ios::sync_with_stdio(false);cin.tie(nullptr);
int T = 1;
// cin >> T;
while (T--)
solve();
return 0;
}