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

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

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

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

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

g.o = k
l.t = i
e.s = j
e.u = j
e.p = k
a.r = j
a.x = h
a.t = e
a.v = d
k.t = i
i.o = k
j.r = a
j.x = d
j.t = e
j.v = i
d.o = k
h.o = k
m.t = g
assert a.v.o.t.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

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

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

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

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

g.o = k
l.t = i
e.s = j
e.u = j
e.p = k
a.r = j
a.x = h
a.t = e
a.v = d
k.t = i
i.o = k
j.r = a
j.x = d
j.t = e
j.v = i
d.o = k
h.o = k
m.t = g
assert a.v.o.t.o.txt == "k"