This trial is conducted in Europe. The aim of this trial is to investigate the pharmacokinetics (the exposure of the trial drug in the body), safety and tolerability after a single injection of semaglutide in subjects with mild, moderate or severe hepatic impairment compared to subjects with normal hepatic function.