first g problem
first solution
new version of solve
revisited