import scala.io.Source.stdin
 
object Main {
  def euclid(m:Int,n:Int):Int = if(n==0) m else euclid(n,m%n)
  def main(args:Array[String]) =
    stdin.getLines.foreach { s=>
      val n = s.split(" ").map(_.toInt)
      println(euclid(n(0),n(1)))
    }
}