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

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

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

e = A("e")
b = B("b")
g = C("g")
i = A("i")
h = C("h")
k = B("k")
a = A("a")

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

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

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

e = A("e")
b = B("b")
g = C("g")
i = A("i")
h = C("h")
k = B("k")
a = A("a")

e.w = i
e.s = b
e.r = b
b.t = h
b.v = h
b.o = i
g.v = h
i.w = a
i.s = k
i.r = b
h.v = g
k.t = g
k.o = e
k.v = h
a.w = e
a.s = k
a.r = k
assert b.o.r.t.v.v.txt == "h"