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

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

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

class D:
    def __init__(self, txt: str):
        self.s: C = None
        self.v: A = None
        self.r: B = None
        self.y: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

n = A("n")
h = B("h")
e = C("e")
b = D("b")
f = E("f")

n.o = f
n.z = h
h.r = b
h.t = n
h.v = f
e.z = n
b.s = e
b.v = n
b.r = h
b.y = f
f.p = h
assert f.p.t.z.txt == "
class A:
    def __init__(self, txt: str):
        self.o: E = None
        self.z: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.s: C = None
        self.v: A = None
        self.r: B = None
        self.y: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

n = A("n")
h = B("h")
e = C("e")
b = D("b")
f = E("f")

n.o = f
n.z = h
h.r = b
h.t = n
h.v = f
e.z = n
b.s = e
b.v = n
b.r = h
b.y = f
f.p = h
assert f.p.t.z.txt == "h"