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

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

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

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

i = A("i")
b = B("b")
e = C("e")
h = D("h")
d = D("d")
a = A("a")
m = B("m")
l = C("l")

i.v = e
i.x = e
i.p = b
i.o = d
b.z = a
b.x = e
b.r = l
e.p = h
h.p = b
h.v = d
h.r = i
h.w = l
d.p = b
d.v = h
d.r = a
d.w = e
a.v = l
a.x = l
a.p = m
a.o = h
m.z = a
m.x = e
m.r = e
l.p = d
assert m.x.p.w.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.p: B = None
        self.o: D = None
        self.x: C = None
        self.txt = txt

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

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

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

i = A("i")
b = B("b")
e = C("e")
h = D("h")
d = D("d")
a = A("a")
m = B("m")
l = C("l")

i.v = e
i.x = e
i.p = b
i.o = d
b.z = a
b.x = e
b.r = l
e.p = h
h.p = b
h.v = d
h.r = i
h.w = l
d.p = b
d.v = h
d.r = a
d.w = e
a.v = l
a.x = l
a.p = m
a.o = h
m.z = a
m.x = e
m.r = e
l.p = d
assert m.x.p.w.txt == "l"