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

class B:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

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

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

e = A("e")
j = B("j")
h = C("h")
b = D("b")
f = B("f")
i = D("i")

e.z = b
e.p = f
j.r = f
h.r = b
h.t = f
h.s = f
h.o = j
b.v = j
b.u = e
b.q = f
f.r = j
i.v = j
i.q = j
i.u = e
assert h.t.r.r.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.p: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

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

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

e = A("e")
j = B("j")
h = C("h")
b = D("b")
f = B("f")
i = D("i")

e.z = b
e.p = f
j.r = f
h.r = b
h.t = f
h.s = f
h.o = j
b.v = j
b.u = e
b.q = f
f.r = j
i.v = j
i.q = j
i.u = e
assert h.t.r.r.r.r.r.txt == "j"