sample and small test case solved. large input still unsolved.