line = gets
line.chomp!

# /(\d+)\s+(\d+)/ =~ line
# a = $1.to_i
# b = $2.to_i

/(\w+)/ =~ line
a = $1

if (a == 'A') then
  print 'T'
elsif (a == 'T') then
  print 'A'
elsif (a == 'C') then
  print 'G'
elsif (a == 'G') then
  print 'C'
end
