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

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

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

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

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

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

c.z = g
j.o = g
j.s = g
m.t = d
l.q = g
g.q = j
d.t = a
a.t = d
b.z = g
assert c.z.q.s.q.s.txt == "
class A:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

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

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

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

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

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

c.z = g
j.o = g
j.s = g
m.t = d
l.q = g
g.q = j
d.t = a
a.t = d
b.z = g
assert c.z.q.s.q.s.txt == "g"