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

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

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

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

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

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

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

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

h.s = n
h.u = m
h.w = m
f.o = b
f.u = n
j.z = f
j.u = f
j.q = b
c.z = f
c.u = f
c.q = h
b.s = f
b.u = j
b.w = j
n.o = b
n.u = f
m.z = f
m.q = b
m.u = n
assert b.u.z.u.txt == "n"