class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.v: G = None
        self.txt = txt

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.t: E = None
        self.q: F = None
        self.o: C = None
        self.x: A = None
        self.txt = txt

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

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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.t: E = None
        self.q: F = None
        self.o: C = None
        self.x: A = None
        self.txt = txt

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

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