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

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

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

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

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

f.r = j
f.y = m
f.q = n
f.v = n
c.z = a
c.v = h
h.w = m
m.s = c
a.r = j
a.y = m
a.q = n
a.v = h
i.z = j
i.v = n
j.r = a
j.y = m
j.q = n
j.v = n
n.w = m
l.z = j
l.v = h
assert n.w.s.z.y.txt == "
class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.y: D = None
        self.q: C = None
        self.v: C = None
        self.txt = txt

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

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

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

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

f.r = j
f.y = m
f.q = n
f.v = n
c.z = a
c.v = h
h.w = m
m.s = c
a.r = j
a.y = m
a.q = n
a.v = h
i.z = j
i.v = n
j.r = a
j.y = m
j.q = n
j.v = n
n.w = m
l.z = j
l.v = h
assert n.w.s.z.y.txt == "m"