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

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

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

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

c = A("c")
l = B("l")
n = C("n")
e = D("e")

c.s = l
c.q = e
l.x = e
n.u = c
n.p = c
n.w = c
e.y = l
assert e.y.x.y.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.q: D = None
        self.txt = txt

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

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

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

c = A("c")
l = B("l")
n = C("n")
e = D("e")

c.s = l
c.q = e
l.x = e
n.u = c
n.p = c
n.w = c
e.y = l
assert e.y.x.y.txt == "l"