def read_inputs
  n = gets.to_i
  taro = Player.new
  hanako = Player.new
  (1..n).each {
    t, h = gets.chomp.split(" ")
    taro.draw(t)
    hanako.draw(h)
  }
  return taro, hanako
end

class Player
  def initialize
    @hand = []
    @score = 0
  end

  def draw(card)
    @hand << card
  end

  def discard
    @hand.shift
  end

  def add_score(value)
    @score += value
  end

  def hasCard
    @hand.length > 0
  end

  attr_reader :score
end

def battle(p1, p2)
  p1_card = p1.discard
  p2_card = p2.discard
  if p1_card == p2_card
    p1.add_score(1)
    p2.add_score(1)
  elsif p1_card > p2_card
    p1.add_score(3)
  else
    p2.add_score(3)
  end
end

taro, hanako = read_inputs
battle(taro, hanako) while taro.hasCard
puts "#{taro.score} #{hanako.score}"