class A:
    def __init__(self, txt: str):
        self.w: G = 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.t: H = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.w: F = None
        self.y: H = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: C = None
        self.q: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.q: E = None
        self.w: A = None
        self.p: C = None
        self.x: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.q: A = None
        self.t: I = None
        self.r: G = None
        self.w: A = None
        self.p: I = None
        self.y: G = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.p: D = None
        self.q: B = None
        self.txt = txt

m = A("m")
a = B("a")
f = C("f")
h = D("h")
i = E("i")
b = F("b")
c = G("c")
l = H("l")
k = I("k")
n = G("n")

m.w = n
a.u = h
f.t = l
h.u = m
h.t = m
h.q = m
i.w = b
i.y = l
b.x = f
b.q = f
c.q = i
c.w = m
c.p = f
c.x = f
l.q = m
l.w = m
l.t = k
l.p = k
l.r = n
l.y = n
k.p = h
k.q = a
n.q = i
n.w = m
n.p = f
n.x = f
assert m.w.q.w.q.t.txt == "
class A:
    def __init__(self, txt: str):
        self.w: G = 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.t: H = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.w: F = None
        self.y: H = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: C = None
        self.q: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.q: E = None
        self.w: A = None
        self.p: C = None
        self.x: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.q: A = None
        self.t: I = None
        self.r: G = None
        self.w: A = None
        self.p: I = None
        self.y: G = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.p: D = None
        self.q: B = None
        self.txt = txt

m = A("m")
a = B("a")
f = C("f")
h = D("h")
i = E("i")
b = F("b")
c = G("c")
l = H("l")
k = I("k")
n = G("n")

m.w = n
a.u = h
f.t = l
h.u = m
h.t = m
h.q = m
i.w = b
i.y = l
b.x = f
b.q = f
c.q = i
c.w = m
c.p = f
c.x = f
l.q = m
l.w = m
l.t = k
l.p = k
l.r = n
l.y = n
k.p = h
k.q = a
n.q = i
n.w = m
n.p = f
n.x = f
assert m.w.q.w.q.t.txt == "l"