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

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

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

i = A("i")
c = B("c")
h = C("h")
k = A("k")
m = C("m")
f = B("f")
b = B("b")
e = B("e")

i.w = b
i.u = f
i.z = m
c.r = m
c.s = k
h.q = f
k.w = f
k.u = c
k.z = h
m.q = e
f.r = m
f.s = i
b.r = h
b.s = k
e.r = m
e.s = i
assert b.r.q.r.q.s.u.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.u: B = None
        self.z: C = None
        self.txt = txt

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

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

i = A("i")
c = B("c")
h = C("h")
k = A("k")
m = C("m")
f = B("f")
b = B("b")
e = B("e")

i.w = b
i.u = f
i.z = m
c.r = m
c.s = k
h.q = f
k.w = f
k.u = c
k.z = h
m.q = e
f.r = m
f.s = i
b.r = h
b.s = k
e.r = m
e.s = i
assert b.r.q.r.q.s.u.txt == "f"