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

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

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

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

h = A("h")
i = B("i")
j = C("j")
f = D("f")
b = D("b")
l = D("l")
d = D("d")
k = A("k")

h.x = k
h.z = j
i.x = h
i.z = k
j.o = i
f.v = j
f.y = j
f.w = l
b.v = j
b.y = j
b.w = l
l.v = j
l.y = j
l.w = d
d.v = j
d.y = j
d.w = l
k.x = h
k.z = j
assert i.x.x.z.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.z: C = None
        self.txt = txt

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

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

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

h = A("h")
i = B("i")
j = C("j")
f = D("f")
b = D("b")
l = D("l")
d = D("d")
k = A("k")

h.x = k
h.z = j
i.x = h
i.z = k
j.o = i
f.v = j
f.y = j
f.w = l
b.v = j
b.y = j
b.w = l
l.v = j
l.y = j
l.w = d
d.v = j
d.y = j
d.w = l
k.x = h
k.z = j
assert i.x.x.z.txt == "j"