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

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: D = None
        self.y: A = None
        self.v: A = None
        self.o: A = None
        self.u: D = None
        self.txt = txt

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

n.y = l
n.o = l
b.r = n
b.q = d
d.z = b
d.r = b
d.s = f
d.q = k
d.o = n
l.q = n
l.u = n
l.r = b
l.s = f
k.s = l
k.u = l
k.y = n
k.v = n
k.o = n
f.z = b
f.r = b
f.s = d
f.q = k
f.o = n
assert d.q.s.r.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.o: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: D = None
        self.y: A = None
        self.v: A = None
        self.o: A = None
        self.u: D = None
        self.txt = txt

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

n.y = l
n.o = l
b.r = n
b.q = d
d.z = b
d.r = b
d.s = f
d.q = k
d.o = n
l.q = n
l.u = n
l.r = b
l.s = f
k.s = l
k.u = l
k.y = n
k.v = n
k.o = n
f.z = b
f.r = b
f.s = d
f.q = k
f.o = n
assert d.q.s.r.txt == "b"