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

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

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

k = A("k")
h = B("h")
e = C("e")
d = B("d")
b = A("b")
f = C("f")
c = C("c")
m = A("m")
a = B("a")
n = B("n")

k.w = m
k.y = b
k.t = c
h.t = d
h.z = k
e.t = m
d.t = n
d.z = k
b.w = m
b.y = k
b.t = e
f.t = b
c.t = k
m.w = k
m.y = b
m.t = c
a.t = h
a.z = b
n.t = d
n.z = m
assert e.t.y.y.w.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.y: A = None
        self.t: C = None
        self.txt = txt

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

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

k = A("k")
h = B("h")
e = C("e")
d = B("d")
b = A("b")
f = C("f")
c = C("c")
m = A("m")
a = B("a")
n = B("n")

k.w = m
k.y = b
k.t = c
h.t = d
h.z = k
e.t = m
d.t = n
d.z = k
b.w = m
b.y = k
b.t = e
f.t = b
c.t = k
m.w = k
m.y = b
m.t = c
a.t = h
a.z = b
n.t = d
n.z = m
assert e.t.y.y.w.t.t.txt == "k"