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

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

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

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

m = A("m")
e = B("e")
j = C("j")
n = D("n")
d = D("d")
h = A("h")
g = D("g")
i = B("i")
k = C("k")
f = B("f")

m.r = n
e.v = m
e.s = m
e.x = m
j.r = g
j.s = n
j.q = h
n.u = j
n.y = m
n.q = g
d.u = k
d.y = h
d.q = n
h.r = n
g.u = k
g.y = h
g.q = n
i.v = h
i.s = h
i.x = h
k.r = g
k.s = n
k.q = m
f.v = m
f.s = m
f.x = m
assert k.s.y.r.y.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

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

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

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

m = A("m")
e = B("e")
j = C("j")
n = D("n")
d = D("d")
h = A("h")
g = D("g")
i = B("i")
k = C("k")
f = B("f")

m.r = n
e.v = m
e.s = m
e.x = m
j.r = g
j.s = n
j.q = h
n.u = j
n.y = m
n.q = g
d.u = k
d.y = h
d.q = n
h.r = n
g.u = k
g.y = h
g.q = n
i.v = h
i.s = h
i.x = h
k.r = g
k.s = n
k.q = m
f.v = m
f.s = m
f.x = m
assert k.s.y.r.y.txt == "m"