class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.x: C = None
        self.y: D = None
        self.t: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.s: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

a = A("a")
i = B("i")
l = C("l")
e = D("e")

a.p = e
a.y = e
a.x = l
a.t = l
i.t = l
i.s = a
l.s = a
e.s = a
assert l.s.x.s.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.x: C = None
        self.y: D = None
        self.t: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.s: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

a = A("a")
i = B("i")
l = C("l")
e = D("e")

a.p = e
a.y = e
a.x = l
a.t = l
i.t = l
i.s = a
l.s = a
e.s = a
assert l.s.x.s.txt == "a"