```python
def step_allowed(start: str, end: str, allowed: list) -> bool:
    if start == end:
        return False
    for move in allowed:
        if move[0] == start and move[1] == end:
            return True
    return False

def step_plan(states: list, allowed: list) -> int:
    if not states:
        raise ValueError("Invalid input: empty list of states")
    
    for i in range(len(states) - 1):
        if not step_allowed(states[i], states[i + 1], allowed):
            return i
    return -1
```