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

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

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

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

c = A("c")
l = B("l")
h = C("h")
b = D("b")
f = D("f")
j = B("j")

c.o = h
c.z = f
l.r = c
l.v = b
h.p = l
h.v = f
h.w = j
h.x = c
b.v = f
b.w = j
f.v = b
f.w = j
j.r = c
j.v = f
assert h.v.w.v.v.w.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.z: D = None
        self.txt = txt

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

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

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

c = A("c")
l = B("l")
h = C("h")
b = D("b")
f = D("f")
j = B("j")

c.o = h
c.z = f
l.r = c
l.v = b
h.p = l
h.v = f
h.w = j
h.x = c
b.v = f
b.w = j
f.v = b
f.w = j
j.r = c
j.v = f
assert h.v.w.v.v.w.txt == "j"