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

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

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

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

j.s = m
j.u = m
f.w = m
f.o = h
h.y = c
h.z = f
c.y = h
c.z = f
m.s = j
m.u = j
assert f.w.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.u: A = None
        self.txt = txt

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

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

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

j.s = m
j.u = m
f.w = m
f.o = h
h.y = c
h.z = f
c.y = h
c.z = f
m.s = j
m.u = j
assert f.w.u.u.u.txt == "j"