import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String alf = "abcdefghijklmnopqrstuvwxyz";
		String salf[] = alf.split("");
		int array_t[] = new int[1000];
		int array_h[] = new int[1000];
		int score_t = 0;
		int score_h = 0;
		int i,m,t,h,k;
		int len;
		int time = scan.nextInt();
		for(i = 0; i < time; i++){
			int d = 0;
			int a = 0;
			int b = 0;
			String t_word = scan.next();
			String h_word = scan.next();
			String st_word[] = t_word.split("");
			String sh_word[] = h_word.split("");
			if(t_word.length() > h_word.length())
				len = h_word.length();
			else
				len = t_word.length();
			for(m = 0; m < len; m++){
				for(t = 0; t < alf.length(); t++){
					if(st_word[m].equals(salf[t])){
						array_t[a++] = t;
					}
				}
				for(h = 0; h < alf.length(); h++){
					if(sh_word[m].equals(salf[h])){
						array_h[b++] = h;
					}
				}
			}
				for(k = 0; k < len; k++){
					if(array_t[k] == array_h[k])
						++d;
					else if(array_t[k] > array_h[k]){
						score_t += 3;
						break;
					}
					else{
						score_h += 3;
						break;
					}
				}
				if(d == len){
					if(t_word.length() == h_word.length()){
						score_t++;
						score_h++;
					}
					else if(t_word.length() > h_word.length())
						score_t += 3;
					else
						score_h += 3;
			}
		}
		System.out.println(score_t+" "+score_h);
	}
}



		

	 import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String alf = "abcdefghijklmnopqrstuvwxyz";
		String salf[] = alf.split("");
		int array_t[] = new int[1000];
		int array_h[] = new int[1000];
		int score_t = 0;
		int score_h = 0;
		int i,m,t,h,k;
		int len;
		int time = scan.nextInt();
		for(i = 0; i < time; i++){
			int d = 0;
			int a = 0;
			int b = 0;
			String t_word = scan.next();
			String h_word = scan.next();
			String st_word[] = t_word.split("");
			String sh_word[] = h_word.split("");
			if(t_word.length() > h_word.length())
				len = h_word.length();
			else
				len = t_word.length();
			for(m = 0; m < len; m++){
				for(t = 0; t < alf.length(); t++){
					if(st_word[m].equals(salf[t])){
						array_t[a++] = t;
					}
				}
				for(h = 0; h < alf.length(); h++){
					if(sh_word[m].equals(salf[h])){
						array_h[b++] = h;
					}
				}
			}
				for(k = 0; k < len; k++){
					if(array_t[k] == array_h[k])
						++d;
					else if(array_t[k] > array_h[k]){
						score_t += 3;
						break;
					}
					else{
						score_h += 3;
						break;
					}
				}
				if(d == len){
					if(t_word.length() == h_word.length()){
						score_t++;
						score_h++;
					}
					else if(t_word.length() > h_word.length())
						score_t += 3;
					else
						score_h += 3;
			}
		}
		System.out.println(score_t+" "+score_h);
	}
} Main public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String alf = "abcdefghijklmnopqrstuvwxyz";
		String salf[] = alf.split("");
		int array_t[] = new int[1000];
		int array_h[] = new int[1000];
		int score_t = 0;
		int score_h = 0;
		int i,m,t,h,k;
		int len;
		int time = scan.nextInt();
		for(i = 0; i < time; i++){
			int d = 0;
			int a = 0;
			int b = 0;
			String t_word = scan.next();
			String h_word = scan.next();
			String st_word[] = t_word.split("");
			String sh_word[] = h_word.split("");
			if(t_word.length() > h_word.length())
				len = h_word.length();
			else
				len = t_word.length();
			for(m = 0; m < len; m++){
				for(t = 0; t < alf.length(); t++){
					if(st_word[m].equals(salf[t])){
						array_t[a++] = t;
					}
				}
				for(h = 0; h < alf.length(); h++){
					if(sh_word[m].equals(salf[h])){
						array_h[b++] = h;
					}
				}
			}
				for(k = 0; k < len; k++){
					if(array_t[k] == array_h[k])
						++d;
					else if(array_t[k] > array_h[k]){
						score_t += 3;
						break;
					}
					else{
						score_h += 3;
						break;
					}
				}
				if(d == len){
					if(t_word.length() == h_word.length()){
						score_t++;
						score_h++;
					}
					else if(t_word.length() > h_word.length())
						score_t += 3;
					else
						score_h += 3;
			}
		}
		System.out.println(score_t+" "+score_h);
	} main {
		Scanner scan = new Scanner(System.in);
		String alf = "abcdefghijklmnopqrstuvwxyz";
		String salf[] = alf.split("");
		int array_t[] = new int[1000];
		int array_h[] = new int[1000];
		int score_t = 0;
		int score_h = 0;
		int i,m,t,h,k;
		int len;
		int time = scan.nextInt();
		for(i = 0; i < time; i++){
			int d = 0;
			int a = 0;
			int b = 0;
			String t_word = scan.next();
			String h_word = scan.next();
			String st_word[] = t_word.split("");
			String sh_word[] = h_word.split("");
			if(t_word.length() > h_word.length())
				len = h_word.length();
			else
				len = t_word.length();
			for(m = 0; m < len; m++){
				for(t = 0; t < alf.length(); t++){
					if(st_word[m].equals(salf[t])){
						array_t[a++] = t;
					}
				}
				for(h = 0; h < alf.length(); h++){
					if(sh_word[m].equals(salf[h])){
						array_h[b++] = h;
					}
				}
			}
				for(k = 0; k < len; k++){
					if(array_t[k] == array_h[k])
						++d;
					else if(array_t[k] > array_h[k]){
						score_t += 3;
						break;
					}
					else{
						score_h += 3;
						break;
					}
				}
				if(d == len){
					if(t_word.length() == h_word.length()){
						score_t++;
						score_h++;
					}
					else if(t_word.length() > h_word.length())
						score_t += 3;
					else
						score_h += 3;
			}
		}
		System.out.println(score_t+" "+score_h);
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String alf = "abcdefghijklmnopqrstuvwxyz"; alf "abcdefghijklmnopqrstuvwxyz" String salf[] = alf.split(""); salf alf.split("") alf.split alf "" int array_t[] = new int[1000]; array_t new int[1000] 1000 int array_h[] = new int[1000]; array_h new int[1000] 1000 int score_t = 0; score_t 0 int score_h = 0; score_h 0 int i i m m t t h h k; k int len; len int time = scan.nextInt(); time scan.nextInt() scan.nextInt scan for(i = 0; i < time; i++){
			int d = 0;
			int a = 0;
			int b = 0;
			String t_word = scan.next();
			String h_word = scan.next();
			String st_word[] = t_word.split("");
			String sh_word[] = h_word.split("");
			if(t_word.length() > h_word.length())
				len = h_word.length();
			else
				len = t_word.length();
			for(m = 0; m < len; m++){
				for(t = 0; t < alf.length(); t++){
					if(st_word[m].equals(salf[t])){
						array_t[a++] = t;
					}
				}
				for(h = 0; h < alf.length(); h++){
					if(sh_word[m].equals(salf[h])){
						array_h[b++] = h;
					}
				}
			}
				for(k = 0; k < len; k++){
					if(array_t[k] == array_h[k])
						++d;
					else if(array_t[k] > array_h[k]){
						score_t += 3;
						break;
					}
					else{
						score_h += 3;
						break;
					}
				}
				if(d == len){
					if(t_word.length() == h_word.length()){
						score_t++;
						score_h++;
					}
					else if(t_word.length() > h_word.length())
						score_t += 3;
					else
						score_h += 3;
			}
		} i = 0; i = 0 i 0 i < time i time i++ i++ i {
			int d = 0;
			int a = 0;
			int b = 0;
			String t_word = scan.next();
			String h_word = scan.next();
			String st_word[] = t_word.split("");
			String sh_word[] = h_word.split("");
			if(t_word.length() > h_word.length())
				len = h_word.length();
			else
				len = t_word.length();
			for(m = 0; m < len; m++){
				for(t = 0; t < alf.length(); t++){
					if(st_word[m].equals(salf[t])){
						array_t[a++] = t;
					}
				}
				for(h = 0; h < alf.length(); h++){
					if(sh_word[m].equals(salf[h])){
						array_h[b++] = h;
					}
				}
			}
				for(k = 0; k < len; k++){
					if(array_t[k] == array_h[k])
						++d;
					else if(array_t[k] > array_h[k]){
						score_t += 3;
						break;
					}
					else{
						score_h += 3;
						break;
					}
				}
				if(d == len){
					if(t_word.length() == h_word.length()){
						score_t++;
						score_h++;
					}
					else if(t_word.length() > h_word.length())
						score_t += 3;
					else
						score_h += 3;
			}
		} {
			int d = 0;
			int a = 0;
			int b = 0;
			String t_word = scan.next();
			String h_word = scan.next();
			String st_word[] = t_word.split("");
			String sh_word[] = h_word.split("");
			if(t_word.length() > h_word.length())
				len = h_word.length();
			else
				len = t_word.length();
			for(m = 0; m < len; m++){
				for(t = 0; t < alf.length(); t++){
					if(st_word[m].equals(salf[t])){
						array_t[a++] = t;
					}
				}
				for(h = 0; h < alf.length(); h++){
					if(sh_word[m].equals(salf[h])){
						array_h[b++] = h;
					}
				}
			}
				for(k = 0; k < len; k++){
					if(array_t[k] == array_h[k])
						++d;
					else if(array_t[k] > array_h[k]){
						score_t += 3;
						break;
					}
					else{
						score_h += 3;
						break;
					}
				}
				if(d == len){
					if(t_word.length() == h_word.length()){
						score_t++;
						score_h++;
					}
					else if(t_word.length() > h_word.length())
						score_t += 3;
					else
						score_h += 3;
			}
		} int d = 0; d 0 int a = 0; a 0 int b = 0; b 0 String t_word = scan.next(); t_word scan.next() scan.next scan String h_word = scan.next(); h_word scan.next() scan.next scan String st_word[] = t_word.split(""); st_word t_word.split("") t_word.split t_word "" String sh_word[] = h_word.split(""); sh_word h_word.split("") h_word.split h_word "" if(t_word.length() > h_word.length())
				len = h_word.length();
			else
				len = t_word.length(); t_word.length() > h_word.length() t_word.length() t_word.length t_word h_word.length() h_word.length h_word len = h_word.length() len h_word.length() h_word.length h_word len = t_word.length() len t_word.length() t_word.length t_word for(m = 0; m < len; m++){
				for(t = 0; t < alf.length(); t++){
					if(st_word[m].equals(salf[t])){
						array_t[a++] = t;
					}
				}
				for(h = 0; h < alf.length(); h++){
					if(sh_word[m].equals(salf[h])){
						array_h[b++] = h;
					}
				}
			} m = 0; m = 0 m 0 m < len m len m++ m++ m {
				for(t = 0; t < alf.length(); t++){
					if(st_word[m].equals(salf[t])){
						array_t[a++] = t;
					}
				}
				for(h = 0; h < alf.length(); h++){
					if(sh_word[m].equals(salf[h])){
						array_h[b++] = h;
					}
				}
			} {
				for(t = 0; t < alf.length(); t++){
					if(st_word[m].equals(salf[t])){
						array_t[a++] = t;
					}
				}
				for(h = 0; h < alf.length(); h++){
					if(sh_word[m].equals(salf[h])){
						array_h[b++] = h;
					}
				}
			} for(t = 0; t < alf.length(); t++){
					if(st_word[m].equals(salf[t])){
						array_t[a++] = t;
					}
				} t = 0; t = 0 t 0 t < alf.length() t alf.length() alf.length alf t++ t++ t {
					if(st_word[m].equals(salf[t])){
						array_t[a++] = t;
					}
				} {
					if(st_word[m].equals(salf[t])){
						array_t[a++] = t;
					}
				} if(st_word[m].equals(salf[t])){
						array_t[a++] = t;
					} st_word[m].equals(salf[t]) st_word[m].equals st_word[m] st_word m salf[t] salf t {
						array_t[a++] = t;
					} array_t[a++] = t array_t[a++] array_t a++ a t for(h = 0; h < alf.length(); h++){
					if(sh_word[m].equals(salf[h])){
						array_h[b++] = h;
					}
				} h = 0; h = 0 h 0 h < alf.length() h alf.length() alf.length alf h++ h++ h {
					if(sh_word[m].equals(salf[h])){
						array_h[b++] = h;
					}
				} {
					if(sh_word[m].equals(salf[h])){
						array_h[b++] = h;
					}
				} if(sh_word[m].equals(salf[h])){
						array_h[b++] = h;
					} sh_word[m].equals(salf[h]) sh_word[m].equals sh_word[m] sh_word m salf[h] salf h {
						array_h[b++] = h;
					} array_h[b++] = h array_h[b++] array_h b++ b h for(k = 0; k < len; k++){
					if(array_t[k] == array_h[k])
						++d;
					else if(array_t[k] > array_h[k]){
						score_t += 3;
						break;
					}
					else{
						score_h += 3;
						break;
					}
				} k = 0; k = 0 k 0 k < len k len k++ k++ k {
					if(array_t[k] == array_h[k])
						++d;
					else if(array_t[k] > array_h[k]){
						score_t += 3;
						break;
					}
					else{
						score_h += 3;
						break;
					}
				} {
					if(array_t[k] == array_h[k])
						++d;
					else if(array_t[k] > array_h[k]){
						score_t += 3;
						break;
					}
					else{
						score_h += 3;
						break;
					}
				} if(array_t[k] == array_h[k])
						++d;
					else if(array_t[k] > array_h[k]){
						score_t += 3;
						break;
					}
					else{
						score_h += 3;
						break;
					} array_t[k] == array_h[k] array_t[k] array_t k array_h[k] array_h k ++d d if(array_t[k] > array_h[k]){
						score_t += 3;
						break;
					}
					else{
						score_h += 3;
						break;
					} array_t[k] > array_h[k] array_t[k] array_t k array_h[k] array_h k {
						score_t += 3;
						break;
					} score_t += 3 score_t 3 break; {
						score_h += 3;
						break;
					} score_h += 3 score_h 3 break; if(d == len){
					if(t_word.length() == h_word.length()){
						score_t++;
						score_h++;
					}
					else if(t_word.length() > h_word.length())
						score_t += 3;
					else
						score_h += 3;
			} d == len d len {
					if(t_word.length() == h_word.length()){
						score_t++;
						score_h++;
					}
					else if(t_word.length() > h_word.length())
						score_t += 3;
					else
						score_h += 3;
			} if(t_word.length() == h_word.length()){
						score_t++;
						score_h++;
					}
					else if(t_word.length() > h_word.length())
						score_t += 3;
					else
						score_h += 3; t_word.length() == h_word.length() t_word.length() t_word.length t_word h_word.length() h_word.length h_word {
						score_t++;
						score_h++;
					} score_t++ score_t score_h++ score_h if(t_word.length() > h_word.length())
						score_t += 3;
					else
						score_h += 3; t_word.length() > h_word.length() t_word.length() t_word.length t_word h_word.length() h_word.length h_word score_t += 3 score_t 3 score_h += 3 score_h 3 System.out.println(score_t+" "+score_h) System.out.println System.out System System.out score_t+" "+score_h score_t+" "+score_h score_t " " score_h String[] args args public class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String alf = "abcdefghijklmnopqrstuvwxyz";
		String salf[] = alf.split("");
		int array_t[] = new int[1000];
		int array_h[] = new int[1000];
		int score_t = 0;
		int score_h = 0;
		int i,m,t,h,k;
		int len;
		int time = scan.nextInt();
		for(i = 0; i < time; i++){
			int d = 0;
			int a = 0;
			int b = 0;
			String t_word = scan.next();
			String h_word = scan.next();
			String st_word[] = t_word.split("");
			String sh_word[] = h_word.split("");
			if(t_word.length() > h_word.length())
				len = h_word.length();
			else
				len = t_word.length();
			for(m = 0; m < len; m++){
				for(t = 0; t < alf.length(); t++){
					if(st_word[m].equals(salf[t])){
						array_t[a++] = t;
					}
				}
				for(h = 0; h < alf.length(); h++){
					if(sh_word[m].equals(salf[h])){
						array_h[b++] = h;
					}
				}
			}
				for(k = 0; k < len; k++){
					if(array_t[k] == array_h[k])
						++d;
					else if(array_t[k] > array_h[k]){
						score_t += 3;
						break;
					}
					else{
						score_h += 3;
						break;
					}
				}
				if(d == len){
					if(t_word.length() == h_word.length()){
						score_t++;
						score_h++;
					}
					else if(t_word.length() > h_word.length())
						score_t += 3;
					else
						score_h += 3;
			}
		}
		System.out.println(score_t+" "+score_h);
	}
} public class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String alf = "abcdefghijklmnopqrstuvwxyz";
		String salf[] = alf.split("");
		int array_t[] = new int[1000];
		int array_h[] = new int[1000];
		int score_t = 0;
		int score_h = 0;
		int i,m,t,h,k;
		int len;
		int time = scan.nextInt();
		for(i = 0; i < time; i++){
			int d = 0;
			int a = 0;
			int b = 0;
			String t_word = scan.next();
			String h_word = scan.next();
			String st_word[] = t_word.split("");
			String sh_word[] = h_word.split("");
			if(t_word.length() > h_word.length())
				len = h_word.length();
			else
				len = t_word.length();
			for(m = 0; m < len; m++){
				for(t = 0; t < alf.length(); t++){
					if(st_word[m].equals(salf[t])){
						array_t[a++] = t;
					}
				}
				for(h = 0; h < alf.length(); h++){
					if(sh_word[m].equals(salf[h])){
						array_h[b++] = h;
					}
				}
			}
				for(k = 0; k < len; k++){
					if(array_t[k] == array_h[k])
						++d;
					else if(array_t[k] > array_h[k]){
						score_t += 3;
						break;
					}
					else{
						score_h += 3;
						break;
					}
				}
				if(d == len){
					if(t_word.length() == h_word.length()){
						score_t++;
						score_h++;
					}
					else if(t_word.length() > h_word.length())
						score_t += 3;
					else
						score_h += 3;
			}
		}
		System.out.println(score_t+" "+score_h);
	}
} Main
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String alf = "abcdefghijklmnopqrstuvwxyz";
		String salf[] = alf.split("");
		int array_t[] = new int[1000];
		int array_h[] = new int[1000];
		int score_t = 0;
		int score_h = 0;
		int i,m,t,h,k;
		int len;
		int time = scan.nextInt();
		for(i = 0; i < time; i++){
			int d = 0;
			int a = 0;
			int b = 0;
			String t_word = scan.next();
			String h_word = scan.next();
			String st_word[] = t_word.split("");
			String sh_word[] = h_word.split("");
			if(t_word.length() > h_word.length())
				len = h_word.length();
			else
				len = t_word.length();
			for(m = 0; m < len; m++){
				for(t = 0; t < alf.length(); t++){
					if(st_word[m].equals(salf[t])){
						array_t[a++] = t;
					}
				}
				for(h = 0; h < alf.length(); h++){
					if(sh_word[m].equals(salf[h])){
						array_h[b++] = h;
					}
				}
			}
				for(k = 0; k < len; k++){
					if(array_t[k] == array_h[k])
						++d;
					else if(array_t[k] > array_h[k]){
						score_t += 3;
						break;
					}
					else{
						score_h += 3;
						break;
					}
				}
				if(d == len){
					if(t_word.length() == h_word.length()){
						score_t++;
						score_h++;
					}
					else if(t_word.length() > h_word.length())
						score_t += 3;
					else
						score_h += 3;
			}
		}
		System.out.println(score_t+" "+score_h);
	}
}



		

	