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

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

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

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

m = A("m")
i = B("i")
g = C("g")
n = D("n")
a = B("a")
d = B("d")
e = C("e")
l = D("l")
j = A("j")
c = D("c")

m.p = l
m.y = d
i.p = c
i.z = m
i.v = j
g.v = d
g.y = d
n.o = l
n.w = g
a.p = c
a.z = m
a.v = m
d.p = c
d.z = m
d.v = j
e.v = a
e.y = d
l.o = c
l.w = g
j.p = l
j.y = a
c.o = l
c.w = g
assert i.p.w.y.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.y: B = None
        self.txt = txt

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

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

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

m = A("m")
i = B("i")
g = C("g")
n = D("n")
a = B("a")
d = B("d")
e = C("e")
l = D("l")
j = A("j")
c = D("c")

m.p = l
m.y = d
i.p = c
i.z = m
i.v = j
g.v = d
g.y = d
n.o = l
n.w = g
a.p = c
a.z = m
a.v = m
d.p = c
d.z = m
d.v = j
e.v = a
e.y = d
l.o = c
l.w = g
j.p = l
j.y = a
c.o = l
c.w = g
assert i.p.w.y.txt == "d"