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

class B:
    def __init__(self, txt: str):
        self.s: G = None
        self.z: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: F = None
        self.x: G = None
        self.u: G = None
        self.s: A = None
        self.t: D = None
        self.q: D = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.u: E = None
        self.o: B = None
        self.z: E = None
        self.y: A = None
        self.t: A = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.s: G = None
        self.z: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: F = None
        self.x: G = None
        self.u: G = None
        self.s: A = None
        self.t: D = None
        self.q: D = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.u: E = None
        self.o: B = None
        self.z: E = None
        self.y: A = None
        self.t: A = None
        self.txt = txt

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

b.v = n
b.z = h
b.w = h
h.s = d
h.z = n
m.s = d
f.z = n
g.r = n
g.x = d
g.u = d
g.s = b
g.t = f
g.q = f
n.t = b
n.u = b
n.z = b
n.y = b
n.v = m
d.u = g
d.z = g
d.o = h
d.y = b
d.t = b
l.r = n
l.x = d
l.u = d
l.s = b
l.t = f
l.q = f
assert g.r.t.w.z.t.v.txt == "n"