
import scala.io.StdIn._
object Main extends App {

  val n = readInt()
  val testimoniesPerPerson: Seq[Seq[(Int, Int)]] = (1 to n).map { _ =>
    val numOfTestimonies = readInt()
    val testimonies: Seq[(Int, Int)] = Seq.fill(numOfTestimonies) {
      val testimony: Array[Int] = readLine().split(" ").map(_.toInt)
      (testimony(0) - 1, testimony(1)) // Modify to 0 origin
    }
    testimonies
  }


  def solve(): Long = {
    (0 until (1 << n)).foldLeft(0L) { case (acc, i) =>
      val isAllTrue = (0 until i).collect { case j if isBitOn(i, j) =>
        testimoniesPerPerson(j).forall { case (x, y) =>
          isSame(y, i & (1 << x))
        }
      }.forall(identity)
      if(isAllTrue) Math.max(acc, countHonest(i)) else acc
    }
  }

  def isBitOn(bit: Long, digit: Long): Boolean =
    (bit & (1 << digit)) != 0

  def isHonest(num: Long): Boolean = num != 0

  def isSame(a: Long, b: Long): Boolean = isHonest(a) == isHonest(b)

  def countHonest(bit: Long): Long =
    (0 until bit.toBinaryString.length).foldLeft(0) { case (acc, digit) =>
      if(isBitOn(bit, digit)) acc + 1 else acc
    }


  println(1)

}
