class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.u: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: C = None
        self.u: A = None
        self.z: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.q: C = None
        self.txt = txt

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

e.z = n
e.u = l
l.p = a
l.u = e
l.z = e
a.u = l
a.t = l
a.y = e
n.p = a
n.q = a
assert l.z.z.p.u.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.u: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: C = None
        self.u: A = None
        self.z: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.q: C = None
        self.txt = txt

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

e.z = n
e.u = l
l.p = a
l.u = e
l.z = e
a.u = l
a.t = l
a.y = e
n.p = a
n.q = a
assert l.z.z.p.u.txt == "l"