#include <string.h>
#include <stdio.h>

int main(void)
{
	int state = 0;

	for (;;) {
		char buf[1024];

		fgets(buf, sizeof(buf), stdin);
		if (feof(stdin))
			break;

		if (strlen(buf) > 1 && buf[strlen(buf) - 1] == 0x0A)
			buf[strlen(buf) - 1] = 0;

		if (strlen(buf) > 1 && buf[strlen(buf) - 1] == 0x0D)
			buf[strlen(buf) - 1] = 0;

		switch (state) {
			case 0:
				if (!strcmp(buf, "COMP"))
					state = 1;
				break;
			case 1:
				printf("%s ", buf);
				state = 2;
				break;
			case 2:
				printf("(%s): ", buf);
				state = 3;
				break;
			case 3:
				printf("%s\n", buf);
				state = 0;
				break;
		}
	}

	return 0;
}
