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

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

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

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

l = A("l")
j = B("j")
a = C("a")
f = D("f")
g = D("g")
h = B("h")
n = C("n")
c = A("c")

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

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

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

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

l = A("l")
j = B("j")
a = C("a")
f = D("f")
g = D("g")
h = B("h")
n = C("n")
c = A("c")

l.v = h
j.u = f
a.v = n
a.t = g
f.z = l
f.p = g
f.x = g
f.v = g
g.z = c
g.p = f
g.x = f
g.v = f
h.u = f
n.v = a
n.t = f
c.v = j
assert h.u.z.v.txt == "h"