class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

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

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

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

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

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

e.y = b
i.p = m
i.r = j
i.o = e
i.v = n
j.q = m
j.x = e
j.z = e
b.p = j
n.p = i
m.p = i
m.r = j
m.o = e
m.v = n
assert i.o.y.p.q.v.p.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

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

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

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

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

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

e.y = b
i.p = m
i.r = j
i.o = e
i.v = n
j.q = m
j.x = e
j.z = e
b.p = j
n.p = i
m.p = i
m.r = j
m.o = e
m.v = n
assert i.o.y.p.q.v.p.txt == "i"