#include <iostream>
#include <string>
using namespace std;
int main(){
int n;
string s;
cin >> n;
for(int i = 0; i < n; i++){
cin >> s;
if(s.length() == 5){
cout << 3 << endl;
} else {
bool one = (s[0] == 'o' && s[2] == 'e') || (s[0] == 'o' && s[1] == 'n') ||
(s[1] == 'n' && s[2] == 'e');
cout << (one ? 1:2) << endl;
}
}
return 0;
}