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

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

class C:
    def __init__(self, txt: str):
        self.r: B = None
        self.y: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: C = None
        self.u: C = None
        self.p: A = None
        self.t: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.r: B = None
        self.y: E = None
        self.q: D = None
        self.txt = txt

j = A("j")
e = B("e")
a = C("a")
g = D("g")
n = E("n")
h = F("h")
l = F("l")
m = E("m")
i = F("i")

j.w = a
e.u = g
a.r = e
a.y = h
g.y = a
g.u = a
g.p = j
g.t = m
n.w = j
h.r = e
h.y = m
h.q = g
l.r = e
l.y = m
l.q = g
m.w = j
i.r = e
i.y = n
i.q = g
assert m.w.w.y.q.t.w.w.r.u.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: B = None
        self.y: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: C = None
        self.u: C = None
        self.p: A = None
        self.t: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.r: B = None
        self.y: E = None
        self.q: D = None
        self.txt = txt

j = A("j")
e = B("e")
a = C("a")
g = D("g")
n = E("n")
h = F("h")
l = F("l")
m = E("m")
i = F("i")

j.w = a
e.u = g
a.r = e
a.y = h
g.y = a
g.u = a
g.p = j
g.t = m
n.w = j
h.r = e
h.y = m
h.q = g
l.r = e
l.y = m
l.q = g
m.w = j
i.r = e
i.y = n
i.q = g
assert m.w.w.y.q.t.w.w.r.u.txt == "g"