works without cheater doubly linked list method. Pair: @AKimZ