#!/usr/bin/perl
use 5.016;
use warnings;
sub gcd { $_[1] ? gcd($_[1], $_[0] % $_[1]) : $_[0] }
sub lcm { $_[0] * $_[1] / gcd($_[0], $_[1]) }
sub f {
my ($p, $q, $e) = @_;
my $lcm = lcm($p - 1, $q - 1);
map{ $_ * $lcm + 1 } (1 .. $p * $q / $lcm); }
say
join ' ', f
(map{ <STDIN> }(1 .. 3));
IyEvdXNyL2Jpbi9wZXJsCnVzZSA1LjAxNjsKdXNlIHdhcm5pbmdzOwoKc3ViIGdjZCB7ICRfWzFdID8gZ2NkKCRfWzFdLCAkX1swXSAlICRfWzFdKSA6ICRfWzBdIH0Kc3ViIGxjbSB7ICRfWzBdICogJF9bMV0gLyBnY2QoJF9bMF0sICRfWzFdKSB9CgpzdWIgZiB7CglteSAoJHAsICRxLCAkZSkgPSBAXzsKCglteSAkbGNtID0gbGNtKCRwIC0gMSwgJHEgLSAxKTsKCglyZXR1cm4gbWFweyAkXyAvICRlIH0KCQlncmVweyAhKCRfICUgJGUpIH0KCQltYXB7ICRfICogJGxjbSArIDEgfSAoMSAuLiAkcCAqICRxIC8gJGxjbSk7Cn0KCnNheSBqb2luICcgJywgZihtYXB7IDxTVERJTj4gfSgxIC4uIDMpKTsK