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

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

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

c = A("c")
i = B("i")
b = C("b")
j = C("j")
n = B("n")
k = A("k")
f = C("f")
d = C("d")
a = C("a")

c.x = i
i.s = f
b.w = i
b.x = k
b.o = c
j.w = n
j.x = k
j.o = c
n.s = b
k.x = i
f.w = n
f.x = k
f.o = c
d.w = i
d.x = k
d.o = c
a.w = n
a.x = k
a.o = k
assert a.o.x.s.w.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

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

c = A("c")
i = B("i")
b = C("b")
j = C("j")
n = B("n")
k = A("k")
f = C("f")
d = C("d")
a = C("a")

c.x = i
i.s = f
b.w = i
b.x = k
b.o = c
j.w = n
j.x = k
j.o = c
n.s = b
k.x = i
f.w = n
f.x = k
f.o = c
d.w = i
d.x = k
d.o = c
a.w = n
a.x = k
a.o = k
assert a.o.x.s.w.txt == "n"