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

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

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

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

j = A("j")
n = B("n")
e = C("e")
f = D("f")
c = D("c")
m = A("m")
b = B("b")
i = C("i")
k = C("k")

j.y = i
n.p = m
n.r = b
e.p = c
e.s = c
e.z = m
e.v = m
f.r = m
f.y = e
f.s = n
f.p = c
c.r = m
c.y = e
c.s = n
c.p = f
m.y = e
b.p = m
b.r = n
i.p = f
i.s = c
i.z = m
i.v = j
k.p = c
k.s = c
k.z = j
k.v = m
assert f.s.p.y.p.r.y.v.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

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

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

j = A("j")
n = B("n")
e = C("e")
f = D("f")
c = D("c")
m = A("m")
b = B("b")
i = C("i")
k = C("k")

j.y = i
n.p = m
n.r = b
e.p = c
e.s = c
e.z = m
e.v = m
f.r = m
f.y = e
f.s = n
f.p = c
c.r = m
c.y = e
c.s = n
c.p = f
m.y = e
b.p = m
b.r = n
i.p = f
i.s = c
i.z = m
i.v = j
k.p = c
k.s = c
k.z = j
k.v = m
assert f.s.p.y.p.r.y.v.txt == "m"