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

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

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

h = A("h")
a = B("a")
c = C("c")
m = B("m")
d = C("d")
e = C("e")
g = A("g")
n = C("n")
i = C("i")
k = C("k")

h.o = g
h.v = c
h.x = i
a.t = d
a.x = e
a.r = m
c.u = a
m.t = e
m.x = c
m.r = a
d.u = m
e.u = m
g.o = h
g.v = e
g.x = c
n.u = m
i.u = m
k.u = m
assert i.u.t.u.x.u.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.v: C = None
        self.x: C = None
        self.txt = txt

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

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

h = A("h")
a = B("a")
c = C("c")
m = B("m")
d = C("d")
e = C("e")
g = A("g")
n = C("n")
i = C("i")
k = C("k")

h.o = g
h.v = c
h.x = i
a.t = d
a.x = e
a.r = m
c.u = a
m.t = e
m.x = c
m.r = a
d.u = m
e.u = m
g.o = h
g.v = e
g.x = c
n.u = m
i.u = m
k.u = m
assert i.u.t.u.x.u.txt == "a"