Sherlock Holmes received a note with some strange strings: ​​Let's date! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hyscvnm​​​. It took him only a minute to figure out that those strange strings are actually referring to the coded time ​​Thursday 14:04​​​ – since the first common capital English letter (case sensitive) shared by the first two strings is the 【PAT (Advanced Level) Practice】1061 Dating (20 分)_字符串 capital letter ​​​D​​​, representing the 4th day in a week; the second common character is the 【PAT (Advanced Level) Practice】1061 Dating (20 分)_2d_02 capital letter ​​​E​​​, representing the 【PAT (Advanced Level) Practice】1061 Dating (20 分)_ios_03 hour (hence the hours from 【PAT (Advanced Level) Practice】1061 Dating (20 分)_4th_04 to 【PAT (Advanced Level) Practice】1061 Dating (20 分)_模拟_05 in a day are represented by the numbers from 【PAT (Advanced Level) Practice】1061 Dating (20 分)_4th_04 to 【PAT (Advanced Level) Practice】1061 Dating (20 分)_4th_07 and the capital letters from ​​​A​​​ to ​​N​​​, respectively); and the English letter shared by the last two strings is ​​s​​​ at the 【PAT (Advanced Level) Practice】1061 Dating (20 分)_字符串 position, representing the 【PAT (Advanced Level) Practice】1061 Dating (20 分)_字符串 minute. Now given two pairs of strings, you are supposed to help Sherlock decode the dating time.

Input Specification:
Each input file contains one test case. Each case gives 【PAT (Advanced Level) Practice】1061 Dating (20 分)_字符串_10 non-empty strings of no more than 【PAT (Advanced Level) Practice】1061 Dating (20 分)_2d_11 characters without white space in 【PAT (Advanced Level) Practice】1061 Dating (20 分)_字符串_10 lines.

Output Specification:
For each test case, print the decoded time in one line, in the format ​​​DAY HH:MM​​​, where ​​DAY​​​ is a 3-character abbreviation for the days in a week – that is, ​​MON​​​ for Monday, ​​TUE​​​ for Tuesday, ​​WED​​​ for Wednesday, ​​THU​​​ for Thursday, ​​FRI​​​ for Friday, ​​SAT​​​ for Saturday, and ​​SUN​​ for Sunday. It is guaranteed that the result is unique for each case.

Sample Input:

3485djDkxh4hhGE
2984akDfkkkkggEdsb
s&hgsfdk
d&Hyscvnm

Sample Output:

THU 14:04

#include<iostream>

using namespace std;

int main(){

string s1, s2, s3, s4;

cin >> s1 >> s2 >> s3 >> s4;

char word[7][4] = {
"MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"
};

int j = 0;
while(true){
if(s1[j] == s2[j] && 'A'<=s1[j] && s1[j]<=('A' + 6)) break;
j++;
}

printf("%s ", word[s1[j] - 'A']);
j++;

while(true){
if(s1[j] == s2[j] && ('0'<=s1[j] && s1[j]<='9' || 'A'<=s1[j] && s1[j]<='N')) break;
j++;
}

int h = s1[j] <= '9'? s1[j] - '0': s1[j]-'A'+10;

printf("%02d:", h);

j = 0;
while(true){
if(s3[j] == s4[j] && ('a'<=s3[j] && s3[j]<='z' || 'A'<=s3[j] && s3[j]<='Z')) break;
j++;
}

printf("%02d", j);

return 0;
}