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

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

class C:
    def __init__(self, txt: str):
        self.x: E = None
        self.o: D = None
        self.p: A = None
        self.w: B = None
        self.s: B = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.x: E = None
        self.o: D = None
        self.p: A = None
        self.w: B = None
        self.s: B = None
        self.txt = txt

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

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

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

i.r = l
i.u = l
a.z = d
a.s = d
a.q = k
a.x = i
a.r = l
l.x = k
l.o = d
l.p = i
l.w = a
l.s = a
d.q = a
d.u = l
d.t = k
k.y = a
k.s = i
k.x = i
k.u = l
k.r = d
assert i.u.o.q.r.x.txt == "k"