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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

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

j.w = n
j.q = l
j.p = c
n.x = j
n.s = b
n.z = c
n.w = c
i.x = n
i.v = n
i.q = n
i.r = b
c.w = b
c.z = l
l.q = c
b.x = n
b.v = n
b.q = n
b.r = i
assert i.r.r.v.s.v.z.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.q: E = None
        self.p: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

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

j.w = n
j.q = l
j.p = c
n.x = j
n.s = b
n.z = c
n.w = c
i.x = n
i.v = n
i.q = n
i.r = b
c.w = b
c.z = l
l.q = c
b.x = n
b.v = n
b.q = n
b.r = i
assert i.r.r.v.s.v.z.txt == "c"