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

class B:
    def __init__(self, txt: str):
        self.v: E = None
        self.o: E = None
        self.txt = txt

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

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

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

j = A("j")
i = B("i")
d = C("d")
k = D("k")
l = E("l")
a = D("a")

j.q = l
i.v = l
i.o = l
d.r = a
d.y = j
d.x = j
d.v = i
k.x = l
k.u = l
k.q = i
k.y = i
k.p = j
l.u = i
l.o = i
l.w = a
a.x = l
a.u = l
a.q = i
a.y = i
a.p = j
assert a.p.q.o.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: E = None
        self.o: E = None
        self.txt = txt

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

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

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

j = A("j")
i = B("i")
d = C("d")
k = D("k")
l = E("l")
a = D("a")

j.q = l
i.v = l
i.o = l
d.r = a
d.y = j
d.x = j
d.v = i
k.x = l
k.u = l
k.q = i
k.y = i
k.p = j
l.u = i
l.o = i
l.w = a
a.x = l
a.u = l
a.q = i
a.y = i
a.p = j
assert a.p.q.o.txt == "i"