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

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

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

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

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

b = A("b")
l = B("l")
c = C("c")
d = D("d")
k = E("k")

b.r = l
b.s = l
b.x = d
b.q = c
l.o = k
l.s = c
c.r = d
c.s = d
c.q = d
c.y = l
c.u = k
d.q = l
d.s = l
d.t = c
k.u = c
k.r = l
k.x = l
k.s = b
assert b.q.u.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.s: B = None
        self.x: D = None
        self.q: C = None
        self.txt = txt

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

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

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

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

b = A("b")
l = B("l")
c = C("c")
d = D("d")
k = E("k")

b.r = l
b.s = l
b.x = d
b.q = c
l.o = k
l.s = c
c.r = d
c.s = d
c.q = d
c.y = l
c.u = k
d.q = l
d.s = l
d.t = c
k.u = c
k.r = l
k.x = l
k.s = b
assert b.q.u.r.txt == "l"