import random


while True:

  print("じゃんけんぽん")

  kekka = "あいこ"

  while kekka == "あいこ":
    pasokon_te = ["グー", "チョキ", "パー"][random.randint(0, 2)]
    jibun_te = input("じゃんけんの手を「グー」「チョキ」「パー」で入力してください==>")
    print("自分:" + jibun_te + ", 相手:" + pasokon_te)

    if jibun_te == "グー" and pasokon_te == "チョキ":
      kekka = "勝ち"
    elif jibun_te == "チョキ" and pasokon_te == "パー":
      kekka = "勝ち"
    elif jibun_te == "パー" and pasokon_te == "グー":
      kekka = "勝ち"
    elif jibun_te == "グー" and pasokon_te == "パー":
      kekka = "負け"
    elif jibun_te == "チョキ" and pasokon_te == "グー":
      kekka = "負け"
    elif jibun_te == "パー" and pasokon_te == "チョキ":
      kekka = "負け"
    else:
      kekka = "あいこ"
      print("あいこでしょ")

  print("じゃんけんは、あなたの" + kekka + "です。")

  print("あっち向いてホイ")

  if kekka == "勝ち":
    acchi_jibun = input("あなたの指の方向を「上」「下」「右」「左」で入力してください。==> ")
    acchi_com = ["上", "下", "右", "左"][random.randint(0, 3)]
    print("自分:" + acchi_jibun + ", 相手:" + acchi_com)

    if acchi_jibun == acchi_com:
      print("あなたの勝ちです。")
      break
    else:
      print("もう一回!")

  else:
    acchi_jibun = input("あなたの首の方向を「上」「下」「右」「左」で入力してください。==> ")
    acchi_com = ["上", "下", "右", "左"][random.randint(0, 3)]
    print("自分:" + acchi_jibun + ", 相手:" + acchi_com)

    if acchi_jibun == acchi_com:
      print("あなたの負けです。")
      break
    else:
      print("もう一回!")