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

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

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

b = A("b")
k = B("k")
f = C("f")
l = C("l")
g = C("g")
i = A("i")
j = A("j")

b.r = i
b.s = l
k.q = j
k.s = b
k.z = f
f.u = b
f.t = l
l.u = b
l.t = f
g.u = b
g.t = f
i.r = b
i.s = g
j.r = i
j.s = f
assert f.t.u.r.s.t.u.s.txt == "
class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.s: C = None
        self.txt = txt

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

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

b = A("b")
k = B("k")
f = C("f")
l = C("l")
g = C("g")
i = A("i")
j = A("j")

b.r = i
b.s = l
k.q = j
k.s = b
k.z = f
f.u = b
f.t = l
l.u = b
l.t = f
g.u = b
g.t = f
i.r = b
i.s = g
j.r = i
j.s = f
assert f.t.u.r.s.t.u.s.txt == "l"