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

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

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

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.o: B = None
        self.txt = txt

e = A("e")
m = B("m")
j = C("j")
f = D("f")
l = D("l")
i = A("i")
k = D("k")

e.t = j
m.z = l
m.t = j
j.x = i
j.q = i
j.t = i
f.p = m
f.o = m
l.p = m
l.o = m
i.t = j
k.p = m
k.o = m
assert m.t.q.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.o: B = None
        self.txt = txt

e = A("e")
m = B("m")
j = C("j")
f = D("f")
l = D("l")
i = A("i")
k = D("k")

e.t = j
m.z = l
m.t = j
j.x = i
j.q = i
j.t = i
f.p = m
f.o = m
l.p = m
l.o = m
i.t = j
k.p = m
k.o = m
assert m.t.q.t.t.txt == "i"