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

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

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

a = A("a")
g = B("g")
f = C("f")
e = A("e")
k = C("k")
d = A("d")
i = C("i")
j = C("j")
h = B("h")
l = C("l")

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

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

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

a = A("a")
g = B("g")
f = C("f")
e = A("e")
k = C("k")
d = A("d")
i = C("i")
j = C("j")
h = B("h")
l = C("l")

a.y = d
a.z = f
g.t = h
g.w = e
g.s = e
f.w = h
f.y = e
f.x = d
e.y = a
e.z = i
k.w = g
k.y = d
k.x = e
d.y = e
d.z = j
i.w = h
i.y = e
i.x = d
j.w = g
j.y = d
j.x = d
h.t = g
h.w = d
h.s = e
l.w = g
l.y = d
l.x = a
assert h.t.s.y.y.z.w.t.s.z.w.txt == "h"