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

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

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

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

k = A("k")
h = B("h")
m = C("m")
e = D("e")
a = D("a")
l = C("l")
d = A("d")
j = D("j")

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

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

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

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

k = A("k")
h = B("h")
m = C("m")
e = D("e")
a = D("a")
l = C("l")
d = A("d")
j = D("j")

k.t = m
k.o = d
k.v = h
h.q = k
h.s = d
h.u = j
h.z = j
m.w = h
m.o = h
e.w = k
e.r = m
e.x = a
a.w = k
a.r = l
a.x = j
l.w = h
l.o = h
d.t = l
d.o = k
d.v = h
j.w = k
j.r = l
j.x = a
assert j.x.r.w.z.x.x.r.w.txt == "h"