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

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

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

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

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

d.s = e
d.x = e
d.r = n
i.x = l
i.r = l
n.x = i
n.r = i
n.q = d
n.o = e
e.s = i
e.x = i
e.y = n
e.q = d
j.x = i
j.r = i
j.q = d
j.o = e
l.x = i
l.r = i
l.q = d
l.o = e
assert e.q.r.q.x.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.r: C = None
        self.x: D = None
        self.txt = txt

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

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

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

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

d.s = e
d.x = e
d.r = n
i.x = l
i.r = l
n.x = i
n.r = i
n.q = d
n.o = e
e.s = i
e.x = i
e.y = n
e.q = d
j.x = i
j.r = i
j.q = d
j.o = e
l.x = i
l.r = i
l.q = d
l.o = e
assert e.q.r.q.x.txt == "e"