implement Solution class