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

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

class C:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

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

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

n.o = j
n.z = f
n.r = h
e.p = i
e.w = i
e.z = n
e.t = h
b.s = a
h.x = d
i.p = e
i.w = e
i.z = g
i.t = j
a.s = b
j.x = e
g.o = h
g.z = h
g.r = j
f.x = d
d.p = i
d.w = i
d.z = g
d.t = j
assert n.o.x.z.r.x.z.o.x.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.z: D = None
        self.r: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

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

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

n.o = j
n.z = f
n.r = h
e.p = i
e.w = i
e.z = n
e.t = h
b.s = a
h.x = d
i.p = e
i.w = e
i.z = g
i.t = j
a.s = b
j.x = e
g.o = h
g.z = h
g.r = j
f.x = d
d.p = i
d.w = i
d.z = g
d.t = j
assert n.o.x.z.r.x.z.o.x.txt == "d"