#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int res[n][7];
  for (int i = 0; i < n; i++) {
    string input;
    cin >> input;
    char buffer[12];
    input.copy(buffer, 12, 0);
    for (int j = 0; j <= 6; j++) res[i][j] = 0;
    for (int j = 0; j < 12; j++) {
      if (buffer[j] == 'X') {
        res[i][1] = 1;
        res[i][0]++;
        break;
      }
    }
    for (int j = 0; j < 6; j++) {
      if (buffer[j] == 'X' && buffer[j + 6] == 'X') {
        res[i][2] = 1;
        res[i][0]++;
        break;
      }
    }
    for (int j = 0; j < 4; j++) {
      if (buffer[j] == 'X' && buffer[j + 4] == 'X' && buffer[j + 8] == 'X') {
        res[i][3] = 1;
        res[i][0]++;
        break;
      }
    }
    for (int j = 0; j < 3; j++) {
      if (buffer[j] == 'X' && buffer[j + 3] == 'X' && buffer[j + 6] == 'X' &&
          buffer[j + 9] == 'X') {
        res[i][4] = 1;
        res[i][0]++;
        break;
      }
    }
    for (int j = 0; j < 2; j++) {
      if (buffer[j] == 'X' && buffer[j + 2] == 'X' && buffer[j + 4] == 'X' &&
          buffer[j + 6] == 'X' && buffer[j + 8] == 'X' &&
          buffer[j + 10] == 'X') {
        res[i][5] = 1;
        res[i][0]++;
        break;
      }
    }
    res[i][6] = 1;
    res[i][0]++;
    for (int j = 0; j < 12; j++) {
      if (buffer[j] != 'X') {
        res[i][6] = 0;
        res[i][0]--;
        break;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    cout << res[i][0];
    for (int j = 1; j <= 6; j++) {
      int k = j;
      if (j == 5) k = 6;
      if (j == 6) k = 12;
      if (res[i][j] == 1) cout << " " << k << "x" << 12 / k;
    }
    cout << endl;
  }
  return 0;
}
