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

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

class C:
    def __init__(self, txt: str):
        self.t: A = 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.w: A = None
        self.y: A = None
        self.r: A = None
        self.txt = txt

c = A("c")
j = B("j")
l = C("l")
g = D("g")
m = E("m")
b = C("b")

c.o = b
c.z = g
j.r = m
l.t = c
g.q = b
m.w = c
m.y = c
m.r = c
b.t = c
assert g.q.t.o.t.o.t.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.z: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: A = 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.w: A = None
        self.y: A = None
        self.r: A = None
        self.txt = txt

c = A("c")
j = B("j")
l = C("l")
g = D("g")
m = E("m")
b = C("b")

c.o = b
c.z = g
j.r = m
l.t = c
g.q = b
m.w = c
m.y = c
m.r = c
b.t = c
assert g.q.t.o.t.o.t.txt == "c"