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

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

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

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

g.x = c
g.v = a
m.w = n
m.t = h
m.o = h
h.o = c
c.w = g
c.t = h
c.o = h
a.w = g
a.t = h
a.o = h
e.x = c
e.v = a
n.x = c
n.v = a
assert c.t.o.w.x.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.v: B = None
        self.txt = txt

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

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

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

g.x = c
g.v = a
m.w = n
m.t = h
m.o = h
h.o = c
c.w = g
c.t = h
c.o = h
a.w = g
a.t = h
a.o = h
e.x = c
e.v = a
n.x = c
n.v = a
assert c.t.o.w.x.o.o.o.txt == "h"