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

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

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

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

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

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

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

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

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

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

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