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

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

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

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

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

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

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

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

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

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

d.p = l
d.o = l
d.z = l
d.x = a
a.o = c
n.w = l
n.v = l
n.y = a
n.r = h
m.r = i
m.s = l
l.w = n
l.v = n
l.y = a
l.r = h
h.o = e
i.r = m
i.s = l
e.p = n
e.o = l
e.z = l
e.x = h
f.r = i
f.s = n
c.p = l
c.z = l
c.o = n
c.x = a
assert i.s.y.o.txt == "c"