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

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

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

class D:
    def __init__(self, txt: str):
        self.x: E = None
        self.y: A = None
        self.t: E = None
        self.s: B = None
        self.p: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: E = None
        self.p: E = None
        self.w: E = None
        self.x: E = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.x: E = None
        self.y: A = None
        self.t: E = None
        self.s: B = None
        self.p: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: E = None
        self.p: E = None
        self.w: E = None
        self.x: E = None
        self.txt = txt

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

h.v = c
e.o = d
e.v = d
e.q = h
e.r = b
c.z = e
b.x = n
b.t = n
b.y = h
b.s = e
b.p = e
d.o = n
d.p = n
d.w = n
d.x = n
n.o = d
n.p = d
n.w = d
n.x = d
assert d.x.o.o.txt == "n"