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

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

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

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

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

l.s = a
l.q = e
l.u = k
l.y = i
a.y = e
a.p = l
a.o = d
f.q = a
f.s = i
e.x = l
k.x = l
i.q = a
i.s = f
d.s = a
d.q = k
d.u = k
d.y = i
assert l.s.p.s.o.y.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.q: D = None
        self.u: D = None
        self.y: C = None
        self.txt = txt

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

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

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

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

l.s = a
l.q = e
l.u = k
l.y = i
a.y = e
a.p = l
a.o = d
f.q = a
f.s = i
e.x = l
k.x = l
i.q = a
i.s = f
d.s = a
d.q = k
d.u = k
d.y = i
assert l.s.p.s.o.y.txt == "i"