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

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: E = None
        self.o: E = None
        self.y: E = None
        self.s: C = None
        self.txt = txt

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

j.p = a
e.y = m
e.z = k
b.w = k
b.o = k
k.o = j
i.t = a
i.o = a
i.y = a
i.s = b
a.t = i
a.o = i
a.y = i
a.s = b
m.p = i
assert a.o.y.o.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: E = None
        self.o: E = None
        self.y: E = None
        self.s: C = None
        self.txt = txt

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

j.p = a
e.y = m
e.z = k
b.w = k
b.o = k
k.o = j
i.t = a
i.o = a
i.y = a
i.s = b
a.t = i
a.o = i
a.y = i
a.s = b
m.p = i
assert a.o.y.o.txt == "i"