#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <math.h>
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <stdlib.h>
#include <cassert>
#include <string.h>

#include <time.h>
#include <random>
#include <iomanip>
using namespace std;

#define ll long long
#define N 35

char g1[N][N], g2[N][N];


void solve() {
    ll w, h, n;
    cin >> w >> h >> n;
    
    ll numOne, numTwo;
    numOne = numTwo = 0;
    
    for (ll r = 0; r < h; r++) {
        for (ll c = 0; c < w; c++) {
            cin >> g1[r][c];
            if (g1[r][c]=='#')
                numOne++;
        }
    }
    
    for (ll r = 0; r < h; r++) {
        for (ll c = 0; c < w; c++) {
            cin >> g2[r][c];
            if (g2[r][c]=='#')
                numTwo++;
        }
    }
    
    ll turn = 1;
    for (ll i = 0; i < n; i++) {
        ll c, r;
        cin >> c >> r;
        r = h-r-1;
        if (turn == 1) {
            if (g2[r][c]=='#') {
                g2[r][c]='_';
                numTwo--;
            }
            else
                turn = 2;
            if (numTwo == 0)
                turn = 2;
        }
        else {
            if (g1[r][c]=='#') {
                g1[r][c]='_';
                numOne--;
            }
            else {
                turn = 1;
                if (numOne==0 && numTwo==0) {
                    for (i++; i < n; i++)
                        cin >> c >> r;
                    cout << "draw" << endl;
                    return;
                }
                else if (numOne==0) {
                    for (i++; i < n; i++)
                        cin >> c >> r;
                    cout << "player two wins" << endl;
                    return;
                }
                else if (numTwo==0) {
                    for (i++; i < n; i++)
                        cin >> c >> r;
                    cout << "player one wins" << endl;
                    return;
                }
            }
            if (numOne == 0) {
                turn = 1;
                if (numOne==0 && numTwo==0) {
                    for (i++; i < n; i++)
                        cin >> c >> r;
                    cout << "draw" << endl;
                    return;
                }
                else if (numOne==0) {
                    for (i++; i < n; i++)
                        cin >> c >> r;
                    cout << "player two wins" << endl;
                    return;
                }
                else if (numTwo==0) {
                    for (i++; i < n; i++)
                        cin >> c >> r;
                    cout << "player one wins" << endl;
                    return;
                }
            }
        }
    }
    
    if (numOne==0 && numTwo==0)
        cout << "draw" << endl;
    else if (numOne==0)
        cout << "player two wins" << endl;
    else if (numTwo==0)
        cout << "player one wins" << endl;
    else
        cout << "draw" << endl;
}

int main() {
    std::ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll t;
    cin >> t;
    for (ll i = 0; i < t; i++) {
        solve();
    }
}