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

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.u: D = None
        self.txt = txt

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.u: D = None
        self.txt = txt

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

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

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

l.u = k
l.s = i
j.z = i
j.u = i
k.q = f
f.q = i
f.r = d
f.u = d
f.y = l
i.q = f
i.r = d
i.u = d
i.y = l
n.u = k
n.s = i
d.z = i
d.u = f
a.u = k
a.s = f
assert l.s.y.s.y.txt == "l"