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

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

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

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

i = A("i")
e = B("e")
d = C("d")
n = D("n")
b = D("b")
l = B("l")

i.q = d
i.s = l
e.q = l
e.x = l
e.u = i
e.o = d
d.p = i
d.q = b
d.v = b
d.u = l
n.s = i
n.u = i
n.q = d
b.s = i
b.u = i
b.q = d
l.q = e
l.x = e
l.u = i
l.o = d
assert e.x.u.s.o.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.s: B = None
        self.txt = txt

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

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

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

i = A("i")
e = B("e")
d = C("d")
n = D("n")
b = D("b")
l = B("l")

i.q = d
i.s = l
e.q = l
e.x = l
e.u = i
e.o = d
d.p = i
d.q = b
d.v = b
d.u = l
n.s = i
n.u = i
n.q = d
b.s = i
b.u = i
b.q = d
l.q = e
l.x = e
l.u = i
l.o = d
assert e.x.u.s.o.txt == "d"