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

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

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

m = A("m")
f = B("f")
i = C("i")
c = A("c")
n = A("n")
d = B("d")
b = A("b")

m.u = c
m.w = f
m.o = f
f.s = m
f.x = i
f.y = i
i.u = d
i.r = d
i.q = d
c.u = m
c.w = d
c.o = d
n.u = c
n.w = f
n.o = d
d.s = c
d.x = i
d.y = i
b.u = n
b.w = f
b.o = d
assert m.u.w.s.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.w: B = None
        self.o: B = None
        self.txt = txt

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

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

m = A("m")
f = B("f")
i = C("i")
c = A("c")
n = A("n")
d = B("d")
b = A("b")

m.u = c
m.w = f
m.o = f
f.s = m
f.x = i
f.y = i
i.u = d
i.r = d
i.q = d
c.u = m
c.w = d
c.o = d
n.u = c
n.w = f
n.o = d
d.s = c
d.x = i
d.y = i
b.u = n
b.w = f
b.o = d
assert m.u.w.s.txt == "c"