#include <iostream> #include <string> using namespace std;
bool isBin(string s) { for (char c : s) { if (c != ‘0’ && c != ‘1’) return false; } return true; }
bool isOct(string s) { for (char c : s) { if (c < ‘0’ || c > ‘7’) return false; } return true; }
bool isDec(string s) { for (char c : s) { if (c < ‘0’ || c > ‘9’) return false; } return true; }
bool isHex(string s) { for (char c : s) { if (!((c >= ‘0’ && c <= ‘9’) || (c >= ‘A’ && c <= ‘F’))) { return false; } } return true; }
int main() { int n; cin >> n; while (n—) { string s; cin >> s;
cout << isBin(s) << " "
<< isOct(s) << " "
<< isDec(s) << " "
<< isHex(s) << endl;
}
return 0;