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

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

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

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

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

j = A("j")
e = B("e")
b = C("b")
c = D("c")
d = E("d")
k = A("k")
m = B("m")
i = E("i")

j.p = i
j.w = d
j.q = e
j.r = k
j.z = b
e.u = k
e.y = b
e.w = b
e.r = m
b.z = i
c.r = m
c.q = m
d.w = k
k.p = d
k.w = i
k.q = m
k.r = j
k.z = b
m.u = k
m.y = b
m.w = b
m.r = e
i.w = k
assert e.w.z.w.r.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.w: E = None
        self.q: B = None
        self.r: A = None
        self.z: C = None
        self.txt = txt

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

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

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

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

j = A("j")
e = B("e")
b = C("b")
c = D("c")
d = E("d")
k = A("k")
m = B("m")
i = E("i")

j.p = i
j.w = d
j.q = e
j.r = k
j.z = b
e.u = k
e.y = b
e.w = b
e.r = m
b.z = i
c.r = m
c.q = m
d.w = k
k.p = d
k.w = i
k.q = m
k.r = j
k.z = b
m.u = k
m.y = b
m.w = b
m.r = e
i.w = k
assert e.w.z.w.r.txt == "j"