class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.o: A = 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.x: A = None
        self.o: B = None
        self.v: B = None
        self.txt = txt

f = A("f")
a = B("a")
d = C("d")
g = C("g")
c = B("c")
m = A("m")
n = A("n")
i = C("i")
j = C("j")

f.w = i
f.o = m
a.t = f
d.x = n
d.o = c
d.v = c
g.x = n
g.o = c
g.v = a
c.t = m
m.w = d
m.o = f
n.w = d
n.o = f
i.x = n
i.o = c
i.v = a
j.x = f
j.o = a
j.v = c
assert c.t.w.x.o.w.o.t.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.o: A = 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.x: A = None
        self.o: B = None
        self.v: B = None
        self.txt = txt

f = A("f")
a = B("a")
d = C("d")
g = C("g")
c = B("c")
m = A("m")
n = A("n")
i = C("i")
j = C("j")

f.w = i
f.o = m
a.t = f
d.x = n
d.o = c
d.v = c
g.x = n
g.o = c
g.v = a
c.t = m
m.w = d
m.o = f
n.w = d
n.o = f
i.x = n
i.o = c
i.v = a
j.x = f
j.o = a
j.v = c
assert c.t.w.x.o.w.o.t.w.txt == "d"