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

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

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

class D:
    def __init__(self, txt: str):
        self.t: A = None
        self.o: C = None
        self.txt = txt

b = A("b")
m = B("m")
k = C("k")
i = D("i")
l = C("l")
n = D("n")
g = B("g")
e = B("e")
c = D("c")
a = D("a")

b.o = c
b.v = l
b.r = i
m.o = g
k.x = b
k.s = a
k.v = l
k.q = m
i.t = b
i.o = k
l.x = b
l.s = i
l.v = k
l.q = g
n.t = b
n.o = k
g.o = e
e.o = m
c.t = b
c.o = k
a.t = b
a.o = l
assert a.o.x.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.v: C = None
        self.r: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: A = None
        self.o: C = None
        self.txt = txt

b = A("b")
m = B("m")
k = C("k")
i = D("i")
l = C("l")
n = D("n")
g = B("g")
e = B("e")
c = D("c")
a = D("a")

b.o = c
b.v = l
b.r = i
m.o = g
k.x = b
k.s = a
k.v = l
k.q = m
i.t = b
i.o = k
l.x = b
l.s = i
l.v = k
l.q = g
n.t = b
n.o = k
g.o = e
e.o = m
c.t = b
c.o = k
a.t = b
a.o = l
assert a.o.x.v.v.txt == "k"