awk 'a=e$2{for($(c=i=FS=e)=$1;e$++i;c=$i%10)(q=sub("^"c,e,a))||$i+=c;FS=OFS}$0=(a?c~a||(e~c&&q):!c)?"YES":"NO"'