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

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

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

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

d.w = g
d.r = n
d.v = f
i.r = j
i.t = e
i.q = a
f.w = a
f.q = e
b.w = g
b.r = n
b.v = f
m.r = i
m.t = e
m.q = a
a.r = m
a.t = g
a.q = i
g.w = b
g.r = b
g.v = f
n.w = e
n.r = d
n.v = f
e.w = d
e.r = g
e.v = f
j.r = m
j.t = e
j.q = i
assert f.w.r.r.t.w.v.q.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.r: A = None
        self.v: C = None
        self.txt = txt

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

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

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

d.w = g
d.r = n
d.v = f
i.r = j
i.t = e
i.q = a
f.w = a
f.q = e
b.w = g
b.r = n
b.v = f
m.r = i
m.t = e
m.q = a
a.r = m
a.t = g
a.q = i
g.w = b
g.r = b
g.v = f
n.w = e
n.r = d
n.v = f
e.w = d
e.r = g
e.v = f
j.r = m
j.t = e
j.q = i
assert f.w.r.r.t.w.v.q.txt == "e"