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

string m[2][30];
int s[2];

int main() {
  ios::sync_with_stdio(0);
  int t; cin >> t;
  while (t--) {
    int w, h, n;
    cin >> w >> h >> n;
    s[0] = s[1] = 0;
    for (int i = 0; i < h; i++) {
      cin >> m[0][i];
      for (int j = 0; j < w; j++)
        s[0] += (m[0][i][j] == '#');
    }
    for (int i = 0; i < h; i++) {
      cin >> m[1][i];
      for (int j = 0; j < w; j++)
        s[1] += (m[1][i][j] == '#');
    }
    bool p1 = true;
    bool done = false;
    for (int i = 0; i < n; i++) {
      int y, x; cin >> y >> x; x = h-x-1;
      if (done)
        continue;
      bool hit = (m[p1][x][y] == '#');
      if (hit) {
        m[p1][x][y] = '_';
        s[p1]--;
      }
      if (!p1) {
        if (!s[0] && !s[1]) {
          done = true;
          cout << "draw\n";
        }
        else if (!s[0]) {
          done = true;
          cout << "player two wins\n";
        }
        else if (!s[1] && !hit) {
          done = true;
          cout << "player one wins\n";
        }
      }
      if (!hit || !s[p1])
        p1 = !p1;
    }
    if (!done)
      cout << "draw\n";
  }
  return 0;
}