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

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

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

k = A("k")
i = B("i")
d = C("d")
m = B("m")
l = C("l")
c = C("c")
h = A("h")

k.z = i
k.t = i
k.y = m
i.x = l
d.w = k
d.y = m
d.v = c
m.x = c
l.w = k
l.y = m
l.v = c
c.w = h
c.y = i
c.v = d
h.z = i
h.y = i
h.t = m
assert l.y.x.v.w.y.x.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.y: B = None
        self.t: B = None
        self.txt = txt

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

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

k = A("k")
i = B("i")
d = C("d")
m = B("m")
l = C("l")
c = C("c")
h = A("h")

k.z = i
k.t = i
k.y = m
i.x = l
d.w = k
d.y = m
d.v = c
m.x = c
l.w = k
l.y = m
l.v = c
c.w = h
c.y = i
c.v = d
h.z = i
h.y = i
h.t = m
assert l.y.x.v.w.y.x.txt == "c"