static int process(String line) {
		int cases = Integer.parseInt(line.trim());
		int[][] data = {
				{21, 0}, 
				{20, 1},
				{21, 2},
				{21, 3},
				{22, 4},
				{22, 5},
				{23, 6},
				{22, 7},
				{24, 8},
				{24, 9},
				{23, 10},
				{23, 11}
		};
		String[] sign= {"Aquarius", "Pisces", "Aries", "Taurus", "Gemini", "Cancer", "Leo", "Virgo", "Libra", "Scorpio", "Sagittarius", "Capricorn"};
		for(int c = 1; c <= cases; c++) {
			String str = readLine().trim();
			int month = Integer.parseInt(str.substring(0, 2));
			int day = Integer.parseInt(str.substring(2, 4));
			int year = Integer.parseInt(str.substring(4));
			Calendar gc = new GregorianCalendar(year, month - 1, day);
			gc.add(Calendar.WEEK_OF_MONTH, 40);
			month = gc.get(gc.MONTH); day = gc.get(gc.DAY_OF_MONTH); year = gc.get(gc.YEAR);
			String s = sign[sign.length - 1];
			for(int i = 0; i < data.length; i++) {
				int n = (i + 1)%data.length;
				if((month == data[i][1] && day >= data[i][0]) || month > data[i][1])
					if(month < data[n][1] || (month == data[n][1] && day < data[n][0])) {
						s = sign[i];
						break;
					}
			}
			
			System.out.println(c+" "+twoPlaces(month+1)+"/"+twoPlaces(day) + "/" +fourPlaces(year)+" "+s.toLowerCase());
		}
		return 0;
	}