#include <bits/stdtr1c++.h>

using namespace std;

int main() {
  ios_base::sync_with_stdio(0);
  int t; cin >> t;
  while (t--) {
    string a[2][30];
    int num_ships[2] = {0, 0};
    int num_turns[2] = {0, 0};
    int w, h, n;
    cin >> w >> h >> n;
    for (int i = 0; i < h; i++)
      cin >> a[0][i];
    for (int i = 0; i < h; i++)
      cin >> a[1][i];
    for (int i = 0; i < 2; i++) {
      for (int j = 0; j < h; j++) {
        for (int k = 0; k < w; k++) {
          num_ships[i] += (a[i][j][k] == '#');
        }
      }
    }
    int cur_player = 0;
    string res = "";
    bool flag = false;
    for (int i = 0; i < n; i++) {
      int x, y;
      cin >> x >> y;
      if (flag) continue;
      if ((num_ships[0] == 0 || num_ships[1] == 0)
         && (num_turns[0] == num_turns[1])) {
        flag = true;
        continue;
      }
      bool hit = a[!cur_player][h-1-y][x] == '#';
      if (hit) {
        a[!cur_player][h-1-y][x] = '_';
        num_ships[!cur_player]--;
        if (num_ships[!cur_player] == 0) {
          num_turns[cur_player]++;
          cur_player = !cur_player;
        }
        continue;
      }
      // if (num_ships[cur_player] == 0 && num_ships[!cur_player] != 0) {
      //   string tmp;
      //   if (cur_player == 0)
      //     tmp = "two";
      //   else
      //     tmp = "one";
      //   res = "player " + tmp + "wins";
      //   flag = true;
      //   continue;
      // }
      num_turns[cur_player]++;
      cur_player = !cur_player;
    }
    if (((num_ships[0] == 0 && num_ships[1] == 0))
        || (num_ships[0] > 0 && num_ships[1] > 0)) {
      res = "draw";
    }
    else if (num_ships[0] == 0)
      res = "player two wins";
    else
      res = "player one wins";
    cout << res << endl;
  }
}