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

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

class C:
    def __init__(self, txt: str):
        self.v: C = None
        self.r: C = None
        self.z: B = None
        self.txt = txt

d = A("d")
a = B("a")
l = C("l")
h = C("h")
c = A("c")
m = C("m")
g = B("g")
k = B("k")
n = C("n")
b = A("b")

d.w = k
a.x = g
a.p = m
l.v = n
l.r = n
l.z = k
h.v = l
h.r = l
h.z = g
c.w = g
m.v = h
m.r = n
m.z = k
g.x = a
g.p = h
k.x = a
k.p = n
n.v = l
n.r = l
n.z = a
b.w = k
assert c.w.p.v.r.v.z.p.z.x.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: C = None
        self.r: C = None
        self.z: B = None
        self.txt = txt

d = A("d")
a = B("a")
l = C("l")
h = C("h")
c = A("c")
m = C("m")
g = B("g")
k = B("k")
n = C("n")
b = A("b")

d.w = k
a.x = g
a.p = m
l.v = n
l.r = n
l.z = k
h.v = l
h.r = l
h.z = g
c.w = g
m.v = h
m.r = n
m.z = k
g.x = a
g.p = h
k.x = a
k.p = n
n.v = l
n.r = l
n.z = a
b.w = k
assert c.w.p.v.r.v.z.p.z.x.txt == "g"