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

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

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

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

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

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

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

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

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

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

f.v = l
f.t = g
j.x = h
j.s = h
j.w = i
n.u = m
n.v = g
n.s = g
n.p = l
g.z = n
l.x = i
l.w = h
l.s = n
h.u = k
h.v = g
h.s = g
h.p = j
k.x = n
k.w = n
k.s = i
m.x = i
m.w = i
m.s = n
a.v = l
a.t = g
i.u = j
i.v = g
i.s = g
i.p = m
assert a.v.x.v.z.u.w.u.x.u.s.txt == "i"