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

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

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

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.z: C = None
        self.w: E = None
        self.o: C = None
        self.txt = txt

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.z: C = None
        self.w: E = None
        self.o: C = None
        self.txt = txt

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

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

i.o = e
i.w = e
i.p = n
i.v = d
e.w = b
e.o = b
d.v = i
d.t = i
b.r = d
b.z = d
b.o = d
b.w = n
n.v = d
n.y = d
assert i.o.w.r.txt == "d"