$/=<>;$_^=1for@d[glob<>];print$$-47&&grep($_,@d)<3?YES:NO