program main
	implicit none
	character(1) :: b
	read(*, *) b
	if(b == 'A') then
		write(*, *) 'T'
	else if(b == 'T') then
		write(*, *) 'A'
	else if(b == 'C') then
		write(*, *) 'G'
	else
		write(*, *) 'C'
	end if
end program main