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

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

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

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

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

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

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

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

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

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

k.t = a
k.z = h
k.r = g
f.x = k
j.u = n
j.x = n
j.o = n
j.z = h
n.u = j
n.r = g
g.t = a
g.z = h
g.r = k
m.u = n
m.x = n
m.o = n
m.z = f
h.x = k
a.x = e
e.t = a
e.z = a
e.r = g
assert f.x.z.x.r.t.x.txt == "e"