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

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.u: D = None
        self.o: E = None
        self.t: E = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.u: D = None
        self.o: E = None
        self.t: E = None
        self.txt = txt

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

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

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

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