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

class B:
    def __init__(self, txt: str):
        self.s: F = None
        self.w: E = None
        self.q: A = None
        self.p: A = None
        self.r: D = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.v: E = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.s: F = None
        self.w: E = None
        self.q: A = None
        self.p: A = None
        self.r: D = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.v: E = None
        self.txt = txt

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

h.v = a
m.s = b
m.w = i
m.q = h
m.p = h
m.r = n
g.v = b
g.p = i
g.u = d
g.s = h
g.t = n
a.w = i
a.y = n
a.t = h
a.u = b
i.q = h
b.v = i
n.w = i
n.y = a
n.t = h
n.u = b
f.s = b
f.w = i
f.q = h
f.p = h
f.r = n
d.v = b
d.p = i
d.u = g
d.s = h
d.t = n
assert m.p.v.u.v.q.v.u.v.txt == "i"