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

class B:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

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

l = A("l")
f = B("f")
g = C("g")
h = D("h")
d = C("d")
m = B("m")
a = B("a")

l.s = h
f.y = a
g.u = l
g.q = d
g.s = d
g.z = h
h.t = f
h.w = l
h.u = d
d.u = l
d.q = g
d.s = g
d.z = h
m.y = f
a.y = f
assert f.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

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

l = A("l")
f = B("f")
g = C("g")
h = D("h")
d = C("d")
m = B("m")
a = B("a")

l.s = h
f.y = a
g.u = l
g.q = d
g.s = d
g.z = h
h.t = f
h.w = l
h.u = d
d.u = l
d.q = g
d.s = g
d.z = h
m.y = f
a.y = f
assert f.y.y.y.txt == "a"