#
# File    : A.rb
# Author  : Kazune Takahashi
# Created : 2019-3-24 20:58:56
# Powered by Visual Studio Code
#

b = gets.chomp
if b == 'A'
  puts 'T'
elsif b == 'T'
  puts 'A'
elsif b == 'C'
  puts 'G'
else
  puts 'C'
end