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

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

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

k = A("k")
d = B("d")
a = C("a")
e = A("e")
b = B("b")
f = B("f")
m = C("m")
l = B("l")
i = B("i")

k.w = a
k.x = e
d.q = k
d.p = a
d.u = f
a.s = m
e.w = a
e.x = k
b.q = k
b.p = a
b.u = d
f.q = k
f.p = m
f.u = i
m.s = a
l.q = e
l.p = m
l.u = d
i.q = k
i.p = m
i.u = l
assert f.u.q.w.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.x: A = None
        self.txt = txt

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

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

k = A("k")
d = B("d")
a = C("a")
e = A("e")
b = B("b")
f = B("f")
m = C("m")
l = B("l")
i = B("i")

k.w = a
k.x = e
d.q = k
d.p = a
d.u = f
a.s = m
e.w = a
e.x = k
b.q = k
b.p = a
b.u = d
f.q = k
f.p = m
f.u = i
m.s = a
l.q = e
l.p = m
l.u = d
i.q = k
i.p = m
i.u = l
assert f.u.q.w.s.s.txt == "a"