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

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

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

f = A("f")
i = B("i")
m = C("m")
h = B("h")
j = B("j")
b = C("b")

f.x = m
f.w = b
f.y = h
i.r = b
i.t = b
m.u = j
h.r = b
h.t = b
j.r = m
j.t = m
b.u = h
assert b.u.t.u.r.u.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.w: C = None
        self.y: B = None
        self.txt = txt

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

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

f = A("f")
i = B("i")
m = C("m")
h = B("h")
j = B("j")
b = C("b")

f.x = m
f.w = b
f.y = h
i.r = b
i.t = b
m.u = j
h.r = b
h.t = b
j.r = m
j.t = m
b.u = h
assert b.u.t.u.r.u.txt == "h"