#include <iostream>
#include <string>
#include <fstream>
using namespace std;

#define in cin
//ifstream in("3279.txt");

int main()
{
	string a, b, c;
	while (in >> a >> b >> c && a != "#") {
		int n, nro, cantA = 0, cantB = 0;
		in >> n;
		for (int i = 0; i < n; i++)
		{
			in >> nro;
			if (c == "even") {
				if (nro % 2 == 0)
					cantB++;
				else
					cantA++;
			} else {
				if (nro % 2 == 0)
					cantA++;
				else
					cantB++;
			}
		}
		cout << a << " " << cantA << " " << b << " " << cantB << " " << endl;
	}
	return 0;
}

