package no3171_color_restration; import java.util.*; public class Main { public static void main(String[] args) { // TODO 自動生成されたメソッド・スタブ Scanner sc = new Scanner(System.in); HashSet one = new HashSet<>(Arrays.asList("gray","brown","green","cyan","blue","yellow","orange","red")); HashSet two =new HashSet<>(Arrays.asList("gray","green","blue","yellow","red")); HashSet three = new HashSet<>(Arrays.asList("gray","green","cyan","blue","violet","orange","red")); String[] abc = new String[3]; String[] check = {"012","021","102","120","201","210"}; for(int i = 0;i < 3;i++) { abc[i] = sc.next(); }HashSet ans = new HashSet<>(); for(int i = 0;i < 6;i++) { int a = check[i].charAt(0) - '0'; int b = check[i].charAt(1) - '0'; int c = check[i].charAt(2) - '0'; boolean ok = true; if(!one.contains(abc[a]))ok = false; if(!two.contains(abc[b]))ok = false; if(!three.contains(abc[c]))ok = false; if(ok) { ans.add(abc[a] + abc[b] + abc[c]); } }System.out.print(ans.size() != 1 ? "No":"Yes"); } }