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

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

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

i = A("i")
l = B("l")
g = C("g")
d = B("d")
c = B("c")
h = C("h")
b = B("b")
m = C("m")

i.w = h
i.u = c
i.v = l
l.s = i
l.o = b
l.r = h
g.t = i
g.u = l
d.s = i
d.o = b
d.r = h
c.s = i
c.o = l
c.r = g
h.t = i
h.u = d
b.s = i
b.o = c
b.r = g
m.t = i
m.u = d
assert b.o.s.v.o.r.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.u: B = None
        self.v: B = None
        self.txt = txt

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

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

i = A("i")
l = B("l")
g = C("g")
d = B("d")
c = B("c")
h = C("h")
b = B("b")
m = C("m")

i.w = h
i.u = c
i.v = l
l.s = i
l.o = b
l.r = h
g.t = i
g.u = l
d.s = i
d.o = b
d.r = h
c.s = i
c.o = l
c.r = g
h.t = i
h.u = d
b.s = i
b.o = c
b.r = g
m.t = i
m.u = d
assert b.o.s.v.o.r.txt == "g"