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

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

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

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

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

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

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

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

i.q = c
e.y = c
e.w = f
a.y = d
a.v = i
d.q = f
c.y = e
c.w = n
g.y = d
g.v = i
j.y = d
j.v = d
m.y = d
m.v = i
f.y = n
f.w = n
n.y = c
n.w = f
assert d.q.y.w.w.w.y.y.y.y.txt == "c"