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

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.v: C = None
        self.p: C = None
        self.txt = txt

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

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

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

n = A("n")
a = B("a")
h = C("h")
c = D("c")
d = E("d")

n.o = h
a.t = h
a.v = h
a.p = h
h.r = d
h.s = d
h.w = a
h.o = n
c.p = d
d.z = n
d.p = n
d.o = c
assert n.o.o.o.s.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.v: C = None
        self.p: C = None
        self.txt = txt

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

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

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

n = A("n")
a = B("a")
h = C("h")
c = D("c")
d = E("d")

n.o = h
a.t = h
a.v = h
a.p = h
h.r = d
h.s = d
h.w = a
h.o = n
c.p = d
d.z = n
d.p = n
d.o = c
assert n.o.o.o.s.txt == "d"