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

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

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

e = A("e")
d = B("d")
f = C("f")
k = A("k")
n = C("n")
g = B("g")
h = A("h")
m = C("m")

e.o = d
e.v = d
d.p = g
d.v = n
d.s = n
f.q = d
f.t = n
k.o = d
k.v = d
n.q = d
n.t = f
g.p = d
g.v = n
g.s = m
h.o = g
h.v = d
m.q = g
m.t = n
assert m.q.s.t.t.t.q.v.t.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.v: B = None
        self.txt = txt

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

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

e = A("e")
d = B("d")
f = C("f")
k = A("k")
n = C("n")
g = B("g")
h = A("h")
m = C("m")

e.o = d
e.v = d
d.p = g
d.v = n
d.s = n
f.q = d
f.t = n
k.o = d
k.v = d
n.q = d
n.t = f
g.p = d
g.v = n
g.s = m
h.o = g
h.v = d
m.q = g
m.t = n
assert m.q.s.t.t.t.q.v.t.txt == "f"