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

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

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

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

a = A("a")
c = B("c")
f = C("f")
l = D("l")
b = B("b")
k = B("k")

a.y = l
c.o = f
c.w = a
c.x = a
c.y = b
f.o = a
f.t = c
f.x = k
l.s = f
l.y = f
l.v = b
l.r = a
b.o = f
b.w = a
b.x = a
b.y = k
k.o = f
k.w = a
k.x = a
k.y = b
assert l.v.w.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

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

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

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

a = A("a")
c = B("c")
f = C("f")
l = D("l")
b = B("b")
k = B("k")

a.y = l
c.o = f
c.w = a
c.x = a
c.y = b
f.o = a
f.t = c
f.x = k
l.s = f
l.y = f
l.v = b
l.r = a
b.o = f
b.w = a
b.x = a
b.y = k
k.o = f
k.w = a
k.x = a
k.y = b
assert l.v.w.y.y.txt == "f"