Problem: There always is something to choose from! And now, instead of "Noughts and Crosses", Inna choose a very unusual upgrade of this game. The rules of the game are given below:

There is one person playing the game. Before the beginning of the game he puts 12 cards in a row on the table. Each card contains a character: "X" or "O". Then the player chooses two positive integers a and b (a·b = 12), after that he makes a table of size a × b from the cards he put on the table as follows: the first b cards form the first row of the table, the second b cards form the second row of the table and so on, the last b cards form the last (number a) row of the table. The player wins if some column of the table contain characters "X" on all cards. Otherwise, the player loses.

Inna has already put 12 cards on the table in a row. But unfortunately, she doesn't know what numbers a and b to choose. Help her win the game: print to her all the possible ways of numbers a, b that she can choose and win.

Input

The first line of the input contains integer t (1 ≤ t ≤ 100). This value shows the number of sets of test data in the input. Next follows the description of each of the t tests on a separate line.

The description of each test is a string consisting of 12 characters, each character is either "X", or "O". The i-th character of the string shows the character that is written on the i-th card from the start.

Output

For each test, print the answer to the test on a single line. The first number in the line must represent the number of distinct ways to choose the pair a, b. Next, print on this line the pairs in the format axb. Print the pairs in the order of increasing first parameter (a). Separate the pairs in the line by whitespaces.

Examples

Input

4
OXXXOXOOXOOX
OXOXOXOXOXOX
XXXXXXXXXXXX
OOOOOOOOOOOO


Output

3 1x12 2x6 4x3
4 1x12 2x6 3x4 6x2
6 1x12 2x6 3x4 4x3 6x2 12x1
0

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return (a / gcd(a, b)) * b; }
bool isPrime(long long n) {
  if (n <= 1) return false;
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) return false;
  }
  return true;
}
inline vector<int> sieve(int n) {
  vector<bool> isPrime(n + 1, true);
  for (int i = 2; i * i <= n; i++) {
    if (isPrime[i])
      for (int j = 2 * i; j <= n; j += i) {
        isPrime[j] = false;
      }
  }
  vector<int> primes;
  for (int i = 2; i <= n; i++)
    if (isPrime[i]) primes.push_back(i);
  return primes;
}
inline vector<bool> sieveQuery(int n) {
  vector<bool> isPrime(n + 1, true);
  for (int i = 2; i <= sqrt(n); i++) {
    if (isPrime[i])
      for (int j = 2 * i; j <= n; j += i) {
        isPrime[j] = false;
      }
  }
  return isPrime;
}
inline vector<long long> primeFactors(long long n) {
  vector<long long> F;
  for (long long i = 2LL; i * i <= n; i++) {
    while (n % i == 0) {
      F.push_back(i);
      n /= i;
    }
  }
  if (n > 1) F.push_back(n);
  return F;
}
inline vector<long long> unsorted_factors(long long n) {
  vector<long long> F;
  long long i = 1;
  for (; i * i < n; i++) {
    if (n % i == 0) {
      F.push_back(i);
      F.push_back(n / i);
    }
  }
  if (i * i == n) F.push_back(i);
  return F;
}
void shift_right(vector<int>& A, int x) {
  int n = A.size();
  x %= n;
  vector<int> B(n);
  for (int i = 0; i < n; i++) B[(i + x) % n] = A[i];
  A = B;
}
string itos(long long n) {
  string s;
  while (n) {
    s += char(n % 10 + 48);
    n /= 10;
  }
  reverse(s.begin(), s.end());
  return s;
}
int cnt_dig(int n) {
  int cnt = 0;
  while (n) {
    cnt++;
    n /= 10;
  }
  return cnt;
}
string binary(int n) {
  string bin;
  while (n) {
    bin += (n % 2 ? '1' : '0');
    n /= 2;
  }
  reverse(bin.begin(), bin.end());
  return bin;
}
bool isPalindrome(string& s) {
  for (int i = 0, j = s.size() - 1; i < j; i++, j--)
    if (s[i] != s[j]) return 0;
  return 1;
}
vector<int> bfs(const vector<vector<int> >& G, int start) {
  int distance = 0, maxDist = 0;
  queue<int> q;
  vector<bool> visited(G.size() + 8, false);
  vector<int> dist(G.size() + 1);
  visited[start] = true;
  q.push(start);
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    visited[u] = true;
    for (int i : G[u])
      if (!visited[i]) {
        q.push(i);
        dist[i] = dist[u] + 1;
        maxDist = max(maxDist, dist[i]);
      }
  }
  vector<int> reqDist;
  for (int i = 2; i < G.size(); i++) {
    if (G[i].size() == 1) reqDist.push_back(dist[i]);
  }
  return reqDist;
}
class DSU {
 private:
  int parent[200009];
  int GroupSize[200009];

 public:
  DSU() {
    for (int i = 0; i < 200009; i++) {
      parent[i] = i;
      GroupSize[i] = 1;
    }
  }
  int findLeader(int i) {
    if (parent[i] == i) return i;
    return parent[i] = findLeader(parent[i]);
  }
  bool sameGroup(int x, int y) {
    int leader1 = findLeader(x);
    int leader2 = findLeader(y);
    return leader1 == leader2;
  }
  void merge(int x, int y) {
    int leader1 = findLeader(x);
    int leader2 = findLeader(y);
    if (leader1 == leader2) return;
    if (GroupSize[leader1] > GroupSize[leader2]) {
      parent[leader2] = leader1;
      GroupSize[leader1] += GroupSize[leader2];
    } else {
      parent[leader1] = leader2;
      GroupSize[leader2] += GroupSize[leader1];
    }
  }
  int getSize(int x) {
    int leader = findLeader(x);
    return GroupSize[leader];
  }
};
bool valid(string& s, int a, int b) {
  vector<string> A;
  for (int i = 0; i < 12 / b; i++) A.push_back(s.substr(i * b, 12 / a));
  bool CAN = 0;
  for (int i = 0; i < b; i++) {
    bool can = 1;
    for (int j = 0; j < a; j++) {
      if (A[j][i] == 'O') can = 0;
    }
    CAN = CAN || can;
  }
  return CAN;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int _t_ = 1;
  cin >> _t_;
  while (_t_--) {
    string s;
    cin >> s;
    int n = s.size();
    vector<pair<int, int> > A;
    if (valid(s, 1, 12)) A.push_back({1, 12});
    if (valid(s, 2, 6)) A.push_back({2, 6});
    if (valid(s, 3, 4)) A.push_back({3, 4});
    if (valid(s, 4, 3)) A.push_back({4, 3});
    if (valid(s, 6, 2)) A.push_back({6, 2});
    if (valid(s, 12, 1)) A.push_back({12, 1});
    cout << A.size() << ' ';
    for (pair<int, int> p : A) cout << p.first << "x" << p.second << ' ';
    cout << '\n';
  }
}