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

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

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

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

g.o = i
g.x = f
g.r = j
f.w = a
m.v = j
m.t = j
m.w = g
d.w = l
l.w = a
i.o = g
i.x = d
i.r = m
a.w = f
j.v = m
j.t = m
j.w = i
assert d.w.w.w.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.x: B = None
        self.r: C = None
        self.txt = txt

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

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

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

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