#include <iostream>
#include <queue>
using namespace std;

int main()
{
    int a,b;
    cin>>a>>b;
    int x;
    cin>>x;
    char mat[a][b];
    int pos[a][b];
    queue<int>Q;
    bool visited[a][b];
    for(int i=0;i<a;i++)
    {
        for(int j=0;j<b;j++)
        {
            cin>>mat[i][j];
            pos[i][j]=0;
            visited[i][j]=false;
        }
    }
    for(int i=0;i<a;i++)
    {
        for(int j=0;j<b;j++)
        {
            if(mat[i][j]=='C')
            {
                Q.push(i);
                Q.push(j);
                Q.push(x);
            for(int k=0;k<a;k++)
            {
                for(int l=0;l<b;l++)
                {
                    visited[k][l]=false;
                }
            }
                visited[i][j] = true;
                while(!Q.empty())
                {
                    int ci=Q.front();
                    Q.pop();
                    int cj=Q.front();
                    Q.pop();
                    int n=Q.front();
                    Q.pop();
                    if(mat[ci][cj]=='.')
                    {
                        pos[ci][cj]++;
                    }
                    if(n - 1 >= 0) {
                    if(cj+1<b && mat[ci][cj+1]!='#' && visited[ci][cj+1]==false)
                    {
                        Q.push(ci);
                        Q.push(cj+1);
                        Q.push(n-1);
                        visited[ci][cj+1]=true;
                    }
                    if(cj-1>=0 && mat[ci][cj-1]!='#' && visited[ci][cj-1]==false)
                    {
                        Q.push(ci);
                        Q.push(cj-1);
                        Q.push(n-1);
                        visited[ci][cj-1]=true;
                    }
                    if(ci+1<a && mat[ci+1][cj]!='#' && visited[ci+1][cj]==false)
                    {
                        Q.push(ci+1);
                        Q.push(cj);
                        Q.push(n-1);
                        visited[ci+1][cj]=true;
                    }
                     if(ci-1>=0 && mat[ci-1][cj]!='#' && visited[ci-1][cj]==false)
                    {
                        Q.push(ci-1);
                        Q.push(cj);
                        Q.push(n-1);
                        visited[ci-1][cj]=true;
                    }
                    }
                }
                while(!Q.empty())
                {
                    Q.pop();
                }
            }
        }
    }
    int najgolem=-1;
    for(int i=0;i<a;i++)
    {
        for(int j=0;j<b;j++)
        {
            if(najgolem<pos[i][j])
            {
                najgolem=pos[i][j];
            }
        }
    }
    //cout<<najgolem;
    for(int i=0;i<a;i++)
    {
        for(int j=0;j<b;j++)
        {
            if(pos[i][j]==najgolem)
            {
                cout<<i+1<<" "<<j+1;
                return 0;
            }
        }
    }
    return 0;
}
