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

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

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

c = A("c")
f = B("f")
m = C("m")
k = C("k")
a = A("a")
l = C("l")
d = B("d")
j = A("j")
h = A("h")
n = A("n")

c.o = d
f.x = k
m.u = a
m.x = d
k.u = h
k.x = d
a.o = f
l.u = j
l.x = d
d.x = k
j.o = d
h.o = f
n.o = f
assert a.o.x.u.o.x.u.o.x.u.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

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

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

c = A("c")
f = B("f")
m = C("m")
k = C("k")
a = A("a")
l = C("l")
d = B("d")
j = A("j")
h = A("h")
n = A("n")

c.o = d
f.x = k
m.u = a
m.x = d
k.u = h
k.x = d
a.o = f
l.u = j
l.x = d
d.x = k
j.o = d
h.o = f
n.o = f
assert a.o.x.u.o.x.u.o.x.u.txt == "h"