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

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

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

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

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

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

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

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

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

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

h.y = k
h.v = f
h.w = j
f.z = h
f.t = h
f.x = k
f.v = b
j.z = i
j.r = h
j.p = k
j.q = k
l.y = j
l.v = b
l.r = b
l.p = f
a.z = h
a.t = b
a.v = b
a.x = i
n.z = k
n.q = k
n.r = h
n.p = i
m.z = l
m.r = b
m.p = k
m.q = i
i.y = n
i.v = h
i.r = h
i.p = f
k.y = m
k.v = b
k.r = h
k.p = a
b.y = i
b.v = f
b.w = n
assert k.y.q.r.y.v.txt == "b"