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

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

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

g = A("g")
e = B("e")
c = C("c")
l = C("l")
d = B("d")
k = A("k")

g.s = d
e.q = k
e.t = l
e.o = d
c.r = d
c.t = k
c.z = e
l.r = d
l.z = d
l.t = k
d.q = k
d.t = l
d.o = e
k.s = e
assert g.s.q.s.t.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

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

g = A("g")
e = B("e")
c = C("c")
l = C("l")
d = B("d")
k = A("k")

g.s = d
e.q = k
e.t = l
e.o = d
c.r = d
c.t = k
c.z = e
l.r = d
l.z = d
l.t = k
d.q = k
d.t = l
d.o = e
k.s = e
assert g.s.q.s.t.txt == "l"