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

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

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

class D:
    def __init__(self, txt: str):
        self.u: A = None
        self.s: E = None
        self.t: A = None
        self.txt = txt

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.u: A = None
        self.s: E = None
        self.t: A = None
        self.txt = txt

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

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

j.y = i
n.p = b
n.r = j
n.w = j
n.y = i
i.z = c
i.r = b
i.u = b
i.p = b
c.u = j
c.t = j
c.s = b
b.r = n
b.v = n
b.q = i
b.o = j
b.y = c
assert n.y.r.q.txt == "i"