Problem: Whist is a game played by four players with a standard deck of playing cards. The players seat around a table, namely, in north, east, south, and west. This game is played in a team-play basis: the players seating opposite to each other become a team. In other words, they make two teams we could call the north-south team and the east-west team.

Remember that the standard deck consists of 52 cards each of which has a rank and a suit. The rank indicates the strength of the card and is one of the following: 2, 3, 4, 5, 6, 7, 8, 9, 10, jack, queen, king, and ace (from the lowest to the highest). The suit refers to the type of symbols printed on the card, namely, spades, hearts, diamonds, and clubs. The deck contains exactly one card for every possible pair of a rank and a suit, thus 52 cards.

One of the four players (called a dealer) shuffles the deck and deals out all the cards face down, one by one, clockwise from the player left to him or her. Each player should have thirteen cards. Then the last dealt card, which belongs to the dealer, is turned face up. The suit of this card is called trumps and has a special meaning as mentioned below.

A deal of this game consists of thirteen tricks. The objective for each team is winning more tricks than another team. The player left to the dealer leads the first trick by playing one of the cards in his or her hand. Then the other players make their plays in the clockwise order. They have to play a card of the suit led if they have one; they can play any card otherwise. The trick is won by the player with the highest card of the suit led if no one plays a trump, or with the highest trump otherwise. The winner of this trick leads the next trick, and the remaining part of the deal is played similarly. After the thirteen tricks have been played, the team winning more tricks gains a score, one point per trick in excess of six.

Your task is to write a program that determines the winning team and their score for given plays of a deal.



Input

The input is a sequence of datasets. Each dataset corresponds to a single deal and has the following format:

Trump
CardN,1 CardN,2 ... CardN,13
CardE,1 CardE,2 ... CardE,13
CardS,1 CardS,2 ... CardS,13
CardW,1 CardW,2 ... CardW,13


Trump indicates the trump suit. CardN,i, CardE,i, CardS,i, and CardW,i denote the card played in the i-th trick by the north, east, south, and west players respectively. Each card is represented by two characters; the first and second character indicates the rank and the suit respectively.

The rank is represented by one of the following characters: ‘2’, ‘3’, ‘4’, ‘5’, ‘6’, ‘7’, ‘8’, ‘9’, ‘T’ (10), ‘J’ (jack), ‘Q’ (queen), ‘K’ (king), and ‘A’ (ace). The suit is represented by one of the following characters: ‘S’ (spades), ‘H’ (hearts), ‘D’ (diamonds), and ‘C’ (clubs).

You should assume the cards have been dealt out by the west player. Thus the first trick is led by the north player. Also, the input does not contain any illegal plays.

The input is terminated by a line with “#”. This is not part of any dataset and thus should not be processed.

Output

For each dataset, print the winner and their score of the deal in a line, with a single space between them as a separator. The winner should be either “NS” (the north-south team) or “EW” (the east-west team). No extra character or whitespace should appear in the output.

Examples

Input

H
4C 8H QS 5D JD KS 8S AH 6H 7H 3S 7S 6D
TC JC JS KD AC QC QD 2H QH 3H 3C 7C 4D
6C 9C AS TD 5H 6S 5S KH TH AD 9S 8D 2D
8C 5C 2S 7D KC 4S TS JH 4H 9H 2C 9D 3D
D
8D 9D 9S QS 4H 5H JD JS 9H 6S TH 6H QH
QD 9C 5S 7S 7H AC 2D KD 6C 3D 8C TC 7C
5D QC 3S 4S 3H 3C 6D KS JC AS 5C 8H TS
4D 4C 8S 2S 2H KC TD JH 2C AH 7D AD KH
#


Output

EW 1
EW 2


Input

H
4C 8H QS 5D JD KS 8S AH 6H 7H 3S 7S 6D
TC JC JS KD AC QC QD 2H QH 3H 3C 7C 4D
6C 9C AS TD 5H 6S 5S KH TH AD 9S 8D 2D
8C 5C 2S 7D KC 4S TS JH 4H 9H 2C 9D 3D
D
8D 9D 9S QS 4H 5H JD JS 9H 6S TH 6H QH
QD 9C 5S 7S 7H AC 2D KD 6C 3D 8C TC 7C
5D QC 3S 4S 3H 3C 6D KS JC AS 5C 8H TS
4D 4C 8S 2S 2H KC TD JH 2C AH 7D AD KH


Output

EW 1
EW 2

Solution (in JAVA):

Solution:
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;



public class Main {
	static final int INF = 2 << 28;
	static final long INF_L = 2L << 60;
	static final int  MOD = 1000000007;
	static final long MOD_L = 1000000007L;
	static final int[] vx_4 = {1,0,-1,0};
	static final int[] vy_4 = {0,-1,0,1};
	static final int[] vx_5 = {1,0,-1,0,0};
	static final int[] vy_5 = {0,1,0,-1,0};
	static final int[] vx_8 = {1,1,1,0,0,-1,-1,-1};
	static final int[] vy_8 = {1,0,-1,1,-1,1,0,-1};
	static final int[] vx_9 = {1,1,1,0,0,0,-1,-1,-1};
	static final int[] vy_9 = {1,0,-1,1,0,-1,1,0,-1};

	public static void main(String[] args) {	
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		while(true) {
			char in = sc.next().charAt(0);
			if(in == '#') break;
			int type = 0;
			if(in == 'S') type = 0;
			if(in == 'H') type = 1;
			if(in == 'D') type = 2;
			if(in == 'C') type = 3;
			
			Data[][] data = new Data[4][13]; 
			for(int i = 0; i < 4; i++) {
				for(int j = 0; j < 13; j++) {
					char[] inx = sc.next().toCharArray();
					int st = 0;
					int ty = 0;
					if(inx[0] == 'T') st = 10;
					else if(inx[0] == 'J') st = 11;
					else if(inx[0] == 'Q') st = 12;
					else if(inx[0] == 'K') st = 13;
					else if(inx[0] == 'A') st = 14;
					else st = inx[0] - '0';
					
					if(inx[1] == 'S') ty = 0;
					if(inx[1] == 'H') ty = 1;
					if(inx[1] == 'D') ty = 2;
					if(inx[1] == 'C') ty = 3;
					
					data[i][j] = new Data(st,ty);
				}
			}
			int[] win = new int[4];
			int leader = 0;
			for(int i = 0; i < 13; i++) {
				boolean isT = false;
				int high = -1;
				int id   = -1;
				int leaderType = data[leader][i].type;
				for(int j = 0; j < 4; j++) {
					Data tmp = data[j][i];
					if(tmp.type == type) {
						if(isT) {
							if(high < tmp.str) {
								high = tmp.str;
								id = j;
							}
						}
						else {
							isT = true;
							high = tmp.str;
							id = j;
						}
					}
					else {
						if(isT) {
							continue;
						}
						else {
							if(high < tmp.str && leaderType == tmp.type) {
								high = tmp.str;
								id = j;
							}
						}
					}	
				}
				win[id]++;
				leader = id;
			}
			if(win[0] + win[2] > win[1] + win[3]) {
				System.out.println("NS " + (win[0] + win[2] - 6));
			}
			else {
				System.out.println("EW " + (win[1] + win[3] - 6));
			}
			
			
		}
	}
	
	static class Data {
		int str;
		int type;
		Data(int a, int b) {
			str = a;
			type = b;
		}
	}

}




class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
    public boolean hasNext() { skipUnprintable(); return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
    	if (!hasNext()) throw new NoSuchElementException();
        int n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
}