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

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

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

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

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

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

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

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

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

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

m.y = c
m.o = j
m.p = j
a.v = e
a.p = e
a.z = n
j.o = d
j.y = d
j.r = l
h.z = l
h.p = c
h.r = c
l.y = c
l.o = c
l.p = c
c.o = h
c.y = n
c.r = l
n.z = l
n.p = j
n.r = j
d.z = m
d.p = c
d.r = j
e.v = a
e.p = a
e.z = d
assert c.y.z.p.r.p.y.r.y.r.txt == "j"