problem 161 intermediate