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

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

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

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

c = A("c")
l = B("l")
g = C("g")
f = D("f")

c.w = f
l.q = g
l.u = g
l.w = c
l.s = f
g.u = c
f.u = g
f.o = l
assert f.u.u.w.o.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

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

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

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

c = A("c")
l = B("l")
g = C("g")
f = D("f")

c.w = f
l.q = g
l.u = g
l.w = c
l.s = f
g.u = c
f.u = g
f.o = l
assert f.u.u.w.o.txt == "l"