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

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: A = None
        self.x: E = None
        self.u: A = None
        self.o: B = None
        self.txt = txt

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

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

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

b.o = j
b.x = m
k.s = i
i.t = b
i.u = b
i.x = j
i.o = k
m.x = i
m.t = i
m.q = e
m.v = k
j.p = m
e.x = i
e.t = i
e.q = m
e.v = k
assert j.p.v.s.txt == "
class A:
    def __init__(self, txt: str):
        self.o: E = None
        self.x: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: A = None
        self.x: E = None
        self.u: A = None
        self.o: B = None
        self.txt = txt

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

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

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

b.o = j
b.x = m
k.s = i
i.t = b
i.u = b
i.x = j
i.o = k
m.x = i
m.t = i
m.q = e
m.v = k
j.p = m
e.x = i
e.t = i
e.q = m
e.v = k
assert j.p.v.s.txt == "i"