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

class B:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.x: A = None
        self.u: E = None
        self.o: C = None
        self.v: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.x: E = None
        self.v: E = None
        self.p: B = None
        self.u: B = None
        self.y: B = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.x: A = None
        self.u: E = None
        self.o: C = None
        self.v: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.x: E = None
        self.v: E = None
        self.p: B = None
        self.u: B = None
        self.y: B = None
        self.txt = txt

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

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

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