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

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

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

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

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

d.x = l
d.z = h
d.v = a
j.u = g
j.r = l
j.x = k
k.y = f
k.p = e
k.w = n
f.t = d
f.q = n
e.t = g
e.q = g
g.x = k
g.z = j
g.v = h
h.u = d
h.r = k
h.x = k
a.u = g
a.r = k
a.x = k
n.x = l
n.z = a
n.v = j
l.y = f
l.p = f
l.w = g
assert a.x.w.x.y.t.x.w.v.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.z: B = None
        self.v: B = None
        self.txt = txt

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

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

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

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

d.x = l
d.z = h
d.v = a
j.u = g
j.r = l
j.x = k
k.y = f
k.p = e
k.w = n
f.t = d
f.q = n
e.t = g
e.q = g
g.x = k
g.z = j
g.v = h
h.u = d
h.r = k
h.x = k
a.u = g
a.r = k
a.x = k
n.x = l
n.z = a
n.v = j
l.y = f
l.p = f
l.w = g
assert a.x.w.x.y.t.x.w.v.txt == "h"