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

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

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

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

m = A("m")
h = B("h")
i = C("i")
j = D("j")
b = C("b")
g = A("g")
a = B("a")
e = B("e")
n = D("n")
c = A("c")

m.v = i
h.q = e
h.s = a
h.z = b
i.s = e
i.p = h
j.u = g
j.w = n
j.v = n
j.y = m
b.s = e
b.p = e
g.v = b
a.q = e
a.s = e
a.z = b
e.q = h
e.s = h
e.z = i
n.u = g
n.w = j
n.v = j
n.y = c
c.v = b
assert j.u.v.p.z.p.z.p.z.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

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

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

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

m = A("m")
h = B("h")
i = C("i")
j = D("j")
b = C("b")
g = A("g")
a = B("a")
e = B("e")
n = D("n")
c = A("c")

m.v = i
h.q = e
h.s = a
h.z = b
i.s = e
i.p = h
j.u = g
j.w = n
j.v = n
j.y = m
b.s = e
b.p = e
g.v = b
a.q = e
a.s = e
a.z = b
e.q = h
e.s = h
e.z = i
n.u = g
n.w = j
n.v = j
n.y = c
c.v = b
assert j.u.v.p.z.p.z.p.z.txt == "i"