How the hell i can write this code?