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

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

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

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

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

f = A("f")
a = B("a")
h = C("h")
n = D("n")
l = E("l")
g = A("g")
k = B("k")

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

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

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

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

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

f = A("f")
a = B("a")
h = C("h")
n = D("n")
l = E("l")
g = A("g")
k = B("k")

f.x = g
f.r = g
f.z = g
f.o = a
a.o = h
a.r = h
a.w = h
a.z = k
h.z = f
h.w = l
h.r = n
h.x = n
n.x = l
l.u = n
l.y = h
l.r = f
l.t = g
g.x = f
g.r = f
g.z = f
g.o = k
k.o = h
k.r = h
k.w = h
k.z = a
assert h.r.x.t.o.z.z.z.txt == "a"