class A:
    def __init__(self, txt: str):
        self.w: G = None
        self.txt = txt

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

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

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

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

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

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

j = A("j")
b = B("b")
d = C("d")
f = D("f")
i = E("i")
m = F("m")
e = G("e")
h = B("h")
n = E("n")

j.w = e
b.z = d
b.r = f
d.v = m
f.y = j
f.z = j
f.q = m
f.w = b
f.p = h
i.s = n
i.o = h
i.x = d
m.z = i
m.u = j
m.t = f
e.q = d
h.z = d
h.r = f
n.s = i
n.o = b
n.x = d
assert h.z.v.z.s.o.z.v.t.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: G = None
        self.txt = txt

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

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

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

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

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

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

j = A("j")
b = B("b")
d = C("d")
f = D("f")
i = E("i")
m = F("m")
e = G("e")
h = B("h")
n = E("n")

j.w = e
b.z = d
b.r = f
d.v = m
f.y = j
f.z = j
f.q = m
f.w = b
f.p = h
i.s = n
i.o = h
i.x = d
m.z = i
m.u = j
m.t = f
e.q = d
h.z = d
h.r = f
n.s = i
n.o = b
n.x = d
assert h.z.v.z.s.o.z.v.t.w.txt == "b"