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

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

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

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

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

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

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

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

f.x = m
f.y = m
m.t = j
m.s = j
j.u = m
h.x = m
h.y = m
assert j.u.t.u.s.txt == "j"