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

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

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

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

n = A("n")
d = B("d")
i = C("i")
g = D("g")
b = C("b")
h = B("h")
k = A("k")
j = C("j")
l = D("l")

n.q = k
n.r = k
n.v = b
d.p = g
d.v = h
d.t = h
d.q = l
i.t = g
i.z = h
i.q = b
i.r = n
g.o = h
b.t = l
b.z = d
b.q = j
b.r = k
h.p = l
h.q = l
h.v = d
h.t = d
k.q = n
k.r = n
k.v = i
j.t = g
j.z = h
j.q = i
j.r = k
l.o = d
assert k.v.r.r.v.z.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.r: A = None
        self.v: C = None
        self.txt = txt

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

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

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

n = A("n")
d = B("d")
i = C("i")
g = D("g")
b = C("b")
h = B("h")
k = A("k")
j = C("j")
l = D("l")

n.q = k
n.r = k
n.v = b
d.p = g
d.v = h
d.t = h
d.q = l
i.t = g
i.z = h
i.q = b
i.r = n
g.o = h
b.t = l
b.z = d
b.q = j
b.r = k
h.p = l
h.q = l
h.v = d
h.t = d
k.q = n
k.r = n
k.v = i
j.t = g
j.z = h
j.q = i
j.r = k
l.o = d
assert k.v.r.r.v.z.q.txt == "l"