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

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

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

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

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

g.o = f
g.t = m
g.z = a
a.y = m
a.x = h
f.z = a
d.u = e
d.z = j
d.v = j
k.z = c
j.u = e
j.z = h
j.v = d
h.u = e
h.z = j
h.v = d
c.y = e
c.x = h
m.o = k
m.t = g
m.z = a
e.o = f
e.t = g
e.z = a
assert c.x.u.t.z.y.z.x.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.t: A = None
        self.z: B = None
        self.txt = txt

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

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

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

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

g.o = f
g.t = m
g.z = a
a.y = m
a.x = h
f.z = a
d.u = e
d.z = j
d.v = j
k.z = c
j.u = e
j.z = h
j.v = d
h.u = e
h.z = j
h.v = d
c.y = e
c.x = h
m.o = k
m.t = g
m.z = a
e.o = f
e.t = g
e.z = a
assert c.x.u.t.z.y.z.x.txt == "h"