function gcd(a, b) {
	if (a < b) return gcd(b, a);
	if (b == 0) return a;
	return gcd(b, a % b);
}

process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function (chunk) {
  var line = chunk.split(' ');
  var a = line[0];
  var b = line[1];
  console.log(gcd(a, b));
});