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

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

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

m = A("m")
f = B("f")
j = C("j")
e = C("e")
i = B("i")
c = B("c")
a = A("a")
d = A("d")
b = A("b")

m.w = f
f.w = i
f.y = c
f.x = m
j.u = i
e.u = i
i.w = c
i.y = c
i.x = m
c.w = i
c.y = f
c.x = a
a.w = c
d.w = f
b.w = i
assert c.w.x.w.y.w.y.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

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

m = A("m")
f = B("f")
j = C("j")
e = C("e")
i = B("i")
c = B("c")
a = A("a")
d = A("d")
b = A("b")

m.w = f
f.w = i
f.y = c
f.x = m
j.u = i
e.u = i
i.w = c
i.y = c
i.x = m
c.w = i
c.y = f
c.x = a
a.w = c
d.w = f
b.w = i
assert c.w.x.w.y.w.y.txt == "c"