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

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

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

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

l = A("l")
b = B("b")
i = C("i")
d = D("d")
e = A("e")
a = D("a")
f = B("f")
g = D("g")

l.w = b
l.v = g
b.y = i
i.o = e
d.x = l
d.z = b
e.w = b
e.v = g
a.x = l
a.z = b
f.y = i
g.x = e
g.z = b
assert l.w.y.o.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.v: D = None
        self.txt = txt

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

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

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

l = A("l")
b = B("b")
i = C("i")
d = D("d")
e = A("e")
a = D("a")
f = B("f")
g = D("g")

l.w = b
l.v = g
b.y = i
i.o = e
d.x = l
d.z = b
e.w = b
e.v = g
a.x = l
a.z = b
f.y = i
g.x = e
g.z = b
assert l.w.y.o.w.txt == "b"