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

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

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

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

g = A("g")
b = B("b")
e = C("e")
h = D("h")
l = A("l")

g.s = h
g.u = h
g.q = b
b.z = e
b.q = h
b.w = l
e.r = b
e.p = h
h.w = b
h.y = b
h.q = e
h.r = l
l.s = h
l.u = h
l.q = b
assert l.u.r.s.y.w.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.q: B = None
        self.u: D = None
        self.txt = txt

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

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

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

g = A("g")
b = B("b")
e = C("e")
h = D("h")
l = A("l")

g.s = h
g.u = h
g.q = b
b.z = e
b.q = h
b.w = l
e.r = b
e.p = h
h.w = b
h.y = b
h.q = e
h.r = l
l.s = h
l.u = h
l.q = b
assert l.u.r.s.y.w.txt == "l"