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

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

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

g = A("g")
a = B("a")
b = C("b")
f = C("f")
e = C("e")
c = C("c")
d = B("d")
h = A("h")
k = C("k")

g.w = h
g.s = d
g.x = a
a.o = d
a.v = d
b.o = k
b.t = g
b.r = c
f.o = c
f.t = h
f.r = k
e.o = b
e.t = h
e.r = c
c.o = e
c.t = g
c.r = f
d.o = a
d.v = a
h.w = g
h.s = a
h.x = d
k.o = f
k.t = h
k.r = c
assert k.t.w.w.w.x.v.v.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.s: B = None
        self.x: B = None
        self.txt = txt

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

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

g = A("g")
a = B("a")
b = C("b")
f = C("f")
e = C("e")
c = C("c")
d = B("d")
h = A("h")
k = C("k")

g.w = h
g.s = d
g.x = a
a.o = d
a.v = d
b.o = k
b.t = g
b.r = c
f.o = c
f.t = h
f.r = k
e.o = b
e.t = h
e.r = c
c.o = e
c.t = g
c.r = f
d.o = a
d.v = a
h.w = g
h.s = a
h.x = d
k.o = f
k.t = h
k.r = c
assert k.t.w.w.w.x.v.v.o.o.txt == "a"