nice solution learned from 9Z.