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

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

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

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.o: B = None
        self.s: D = None
        self.q: D = None
        self.txt = txt

b = A("b")
m = B("m")
n = C("n")
a = D("a")
c = A("c")
f = D("f")
l = C("l")
d = A("d")
j = B("j")

b.y = a
b.r = m
b.t = f
m.y = n
m.s = n
m.z = n
m.p = b
n.z = m
n.q = a
n.v = f
a.p = m
a.o = j
a.s = f
a.q = f
c.y = f
c.r = m
c.t = a
f.p = m
f.o = j
f.s = a
f.q = a
l.z = j
l.q = a
l.v = f
d.y = a
d.r = j
d.t = f
j.y = l
j.s = l
j.z = l
j.p = d
assert m.p.y.o.y.v.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.r: B = None
        self.t: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.o: B = None
        self.s: D = None
        self.q: D = None
        self.txt = txt

b = A("b")
m = B("m")
n = C("n")
a = D("a")
c = A("c")
f = D("f")
l = C("l")
d = A("d")
j = B("j")

b.y = a
b.r = m
b.t = f
m.y = n
m.s = n
m.z = n
m.p = b
n.z = m
n.q = a
n.v = f
a.p = m
a.o = j
a.s = f
a.q = f
c.y = f
c.r = m
c.t = a
f.p = m
f.o = j
f.s = a
f.q = a
l.z = j
l.q = a
l.v = f
d.y = a
d.r = j
d.t = f
j.y = l
j.s = l
j.z = l
j.p = d
assert m.p.y.o.y.v.q.q.txt == "f"