class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.p: D = None
        self.txt = txt

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

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

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

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

g.v = a
g.p = d
m.u = a
m.z = h
m.s = g
e.u = g
e.q = g
e.s = m
d.v = i
d.p = a
d.w = j
d.y = g
j.v = g
j.p = m
j.w = d
j.y = i
h.u = m
h.z = m
h.s = i
k.u = i
k.s = h
k.q = g
f.u = a
f.z = m
f.s = i
a.u = h
a.z = m
a.s = g
i.v = a
i.p = d
assert i.v.z.u.u.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.p: D = None
        self.txt = txt

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

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

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

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

g.v = a
g.p = d
m.u = a
m.z = h
m.s = g
e.u = g
e.q = g
e.s = m
d.v = i
d.p = a
d.w = j
d.y = g
j.v = g
j.p = m
j.w = d
j.y = i
h.u = m
h.z = m
h.s = i
k.u = i
k.s = h
k.q = g
f.u = a
f.z = m
f.s = i
a.u = h
a.z = m
a.s = g
i.v = a
i.p = d
assert i.v.z.u.u.z.z.txt == "h"