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

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

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

k = A("k")
m = B("m")
n = C("n")
j = B("j")
f = B("f")
i = C("i")
e = A("e")
h = B("h")
d = C("d")
g = B("g")

k.x = e
k.z = n
m.u = e
m.t = d
n.w = g
n.s = k
n.y = d
j.u = e
j.t = d
f.u = k
f.t = i
i.w = g
i.s = e
i.y = d
e.x = k
e.z = i
h.u = k
h.t = i
d.w = h
d.s = k
d.y = n
g.u = k
g.t = d
assert n.w.t.w.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.z: C = None
        self.txt = txt

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

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

k = A("k")
m = B("m")
n = C("n")
j = B("j")
f = B("f")
i = C("i")
e = A("e")
h = B("h")
d = C("d")
g = B("g")

k.x = e
k.z = n
m.u = e
m.t = d
n.w = g
n.s = k
n.y = d
j.u = e
j.t = d
f.u = k
f.t = i
i.w = g
i.s = e
i.y = d
e.x = k
e.z = i
h.u = k
h.t = i
d.w = h
d.s = k
d.y = n
g.u = k
g.t = d
assert n.w.t.w.txt == "h"