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

class B:
    def __init__(self, txt: str):
        self.v: B = None
        self.s: F = None
        self.y: F = None
        self.z: E = None
        self.w: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: E = None
        self.p: A = None
        self.y: B = None
        self.w: E = None
        self.t: F = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.q: D = None
        self.p: A = None
        self.z: E = None
        self.x: C = None
        self.t: B = None
        self.txt = txt

m = A("m")
h = B("h")
d = C("d")
b = D("b")
k = E("k")
a = F("a")
f = D("f")
e = B("e")
g = A("g")

m.w = e
m.u = g
m.v = g
h.v = e
h.s = a
h.y = a
h.z = k
h.w = m
d.r = k
d.w = k
d.p = m
d.y = h
d.t = a
b.x = e
b.q = g
b.w = g
b.p = d
k.u = f
k.q = h
a.q = f
a.p = g
a.z = k
a.x = d
a.t = e
f.x = e
f.q = g
f.w = g
f.p = d
e.v = h
e.s = a
e.y = a
e.z = k
e.w = g
g.w = e
g.u = m
g.v = m
assert k.q.z.q.w.w.z.q.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.u: A = None
        self.v: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: B = None
        self.s: F = None
        self.y: F = None
        self.z: E = None
        self.w: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: E = None
        self.p: A = None
        self.y: B = None
        self.w: E = None
        self.t: F = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.q: D = None
        self.p: A = None
        self.z: E = None
        self.x: C = None
        self.t: B = None
        self.txt = txt

m = A("m")
h = B("h")
d = C("d")
b = D("b")
k = E("k")
a = F("a")
f = D("f")
e = B("e")
g = A("g")

m.w = e
m.u = g
m.v = g
h.v = e
h.s = a
h.y = a
h.z = k
h.w = m
d.r = k
d.w = k
d.p = m
d.y = h
d.t = a
b.x = e
b.q = g
b.w = g
b.p = d
k.u = f
k.q = h
a.q = f
a.p = g
a.z = k
a.x = d
a.t = e
f.x = e
f.q = g
f.w = g
f.p = d
e.v = h
e.s = a
e.y = a
e.z = k
e.w = g
g.w = e
g.u = m
g.v = m
assert k.q.z.q.w.w.z.q.txt == "h"