First verson of the 2nd and 3rd problem