from dataclasses import dataclass, field
from datetime import datetime, timedelta


@dataclass(order=True)
class Train:
    id: int = field(compare=False)
    to: str
    leaves_at: datetime = field(default_factory=datetime.now)


now = datetime.now()
trains = [Train(i, f"somewhere{i}", now + timedelta(hours=i)) for i in range(1, 6)]
print(*trains, sep="\n", end="\n\n")
print(*sorted(trains), sep="\n")


def sort_by_id(trains: list[Train]) -> list[Train]:
    return sorted(trains, key=lambda train: train.id)


def get_from_user() -> None:
    id = int(input())
    print(trains[id])
