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

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

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

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

d = A("d")
e = B("e")
c = C("c")
a = D("a")
i = C("i")
h = C("h")
j = D("j")
n = B("n")
k = A("k")

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

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

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

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

d = A("d")
e = B("e")
c = C("c")
a = D("a")
i = C("i")
h = C("h")
j = D("j")
n = B("n")
k = A("k")

d.q = n
d.v = j
d.x = j
e.r = d
e.s = d
e.v = h
e.q = j
c.y = a
a.v = e
a.x = d
a.y = d
a.q = j
i.y = j
h.y = j
j.v = e
j.x = k
j.y = k
j.q = a
n.r = k
n.s = k
n.v = h
n.q = j
k.q = e
k.v = j
k.x = j
assert n.v.y.v.r.v.txt == "j"