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

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

class C:
    def __init__(self, txt: str):
        self.u: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: C = None
        self.v: B = None
        self.o: B = None
        self.w: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: C = None
        self.x: B = None
        self.y: B = None
        self.p: D = None
        self.txt = txt

k = A("k")
h = B("h")
e = C("e")
b = D("b")
d = E("d")

k.p = d
h.s = d
h.t = k
h.o = k
h.x = e
e.u = d
b.x = e
b.v = h
b.o = h
b.w = d
d.v = e
d.x = h
d.y = h
d.p = b
assert b.w.v.u.x.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: C = None
        self.v: B = None
        self.o: B = None
        self.w: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: C = None
        self.x: B = None
        self.y: B = None
        self.p: D = None
        self.txt = txt

k = A("k")
h = B("h")
e = C("e")
b = D("b")
d = E("d")

k.p = d
h.s = d
h.t = k
h.o = k
h.x = e
e.u = d
b.x = e
b.v = h
b.o = h
b.w = d
d.v = e
d.x = h
d.y = h
d.p = b
assert b.w.v.u.x.txt == "h"