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

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

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

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

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

g.w = l
l.y = g
l.p = g
l.u = i
m.x = f
m.v = i
m.o = g
m.s = g
f.s = i
h.y = g
h.p = g
h.u = i
i.s = f
assert h.u.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

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

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

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

g.w = l
l.y = g
l.p = g
l.u = i
m.x = f
m.v = i
m.o = g
m.s = g
f.s = i
h.y = g
h.p = g
h.u = i
i.s = f
assert h.u.s.s.txt == "i"