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

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

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

class D:
    def __init__(self, txt: str):
        self.s: C = None
        self.u: E = None
        self.y: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.txt = txt

j = A("j")
h = B("h")
g = C("g")
l = D("l")
k = E("k")

j.y = g
j.t = g
h.o = g
g.z = h
l.s = g
l.u = k
l.y = h
k.q = j
assert h.o.z.o.z.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.t: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.s: C = None
        self.u: E = None
        self.y: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.txt = txt

j = A("j")
h = B("h")
g = C("g")
l = D("l")
k = E("k")

j.y = g
j.t = g
h.o = g
g.z = h
l.s = g
l.u = k
l.y = h
k.q = j
assert h.o.z.o.z.txt == "h"