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

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: A = None
        self.p: D = None
        self.q: B = None
        self.v: B = None
        self.o: D = None
        self.txt = txt

k = A("k")
h = B("h")
b = C("b")
m = D("m")
i = E("i")
c = B("c")
j = A("j")

k.z = m
k.t = m
h.t = k
b.y = i
m.q = b
i.r = j
i.p = m
i.o = m
i.q = h
i.v = c
c.t = j
j.z = m
j.t = m
assert i.r.z.q.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.t: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: A = None
        self.p: D = None
        self.q: B = None
        self.v: B = None
        self.o: D = None
        self.txt = txt

k = A("k")
h = B("h")
b = C("b")
m = D("m")
i = E("i")
c = B("c")
j = A("j")

k.z = m
k.t = m
h.t = k
b.y = i
m.q = b
i.r = j
i.p = m
i.o = m
i.q = h
i.v = c
c.t = j
j.z = m
j.t = m
assert i.r.z.q.txt == "b"