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

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

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

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

k.s = c
l.q = g
c.u = b
b.q = g
g.s = c
e.q = k
assert e.q.s.u.q.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

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

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

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

k.s = c
l.q = g
c.u = b
b.q = g
g.s = c
e.q = k
assert e.q.s.u.q.s.txt == "c"