Logo
(追記) (追記ここまで)

26551번 - Family 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB49413984.783%

문제

You have been given bits and pieces of your family tree. Your task is to determine if two people are related based on several connections.

입력

The first line will contain a single integer n that indicates the number of connections. The next n lines will consist of a name, a connection, and another name. The connections will be either mom, dad, brother, sister, daughter, or son. The next line will contain a single integer m that indicates the number of test cases. The next m lines will consist of two names. Your program should determine if the two names are related.

출력

Output either Related or Not Related, depending on whether they are connected or not. There will be m lines of output.

제한

예제 입력 1

3
John brother Susan
Kim mom John
Dave son Jim
2
Jim John
Kim Susan

예제 출력 1

Not Related
Related

힌트

출처

School > PLU High School Programming Contest > PLU 2018 > Novice 8번

School > PLU High School Programming Contest > PLU 2018 > Advanced 8번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /