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

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

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

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

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

i = A("i")
e = B("e")
m = C("m")
f = D("f")
k = E("k")
a = B("a")

i.p = k
e.r = m
e.x = f
e.u = f
e.v = a
e.q = a
m.z = i
f.p = i
k.r = i
k.y = m
k.q = a
k.o = e
k.v = f
a.r = m
a.x = f
a.u = f
a.v = e
a.q = e
assert e.x.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

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

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

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

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

i = A("i")
e = B("e")
m = C("m")
f = D("f")
k = E("k")
a = B("a")

i.p = k
e.r = m
e.x = f
e.u = f
e.v = a
e.q = a
m.z = i
f.p = i
k.r = i
k.y = m
k.q = a
k.o = e
k.v = f
a.r = m
a.x = f
a.u = f
a.v = e
a.q = e
assert e.x.p.p.txt == "k"