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

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

class C:
    def __init__(self, txt: str):
        self.q: G = None
        self.w: B = None
        self.v: E = None
        self.x: G = None
        self.u: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: C = None
        self.y: A = None
        self.x: C = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.z: A = None
        self.s: A = None
        self.v: D = None
        self.x: B = None
        self.txt = txt

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

f.y = m
f.z = h
g.r = c
e.q = d
e.x = d
e.w = g
e.v = m
e.u = c
c.s = e
c.x = e
c.y = f
m.z = h
m.p = f
h.u = d
h.v = e
h.s = e
d.z = f
d.s = f
d.v = c
d.x = g
i.u = d
i.v = e
i.s = e
assert h.v.u.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.z: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: G = None
        self.w: B = None
        self.v: E = None
        self.x: G = None
        self.u: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: C = None
        self.y: A = None
        self.x: C = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.z: A = None
        self.s: A = None
        self.v: D = None
        self.x: B = None
        self.txt = txt

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

f.y = m
f.z = h
g.r = c
e.q = d
e.x = d
e.w = g
e.v = m
e.u = c
c.s = e
c.x = e
c.y = f
m.z = h
m.p = f
h.u = d
h.v = e
h.s = e
d.z = f
d.s = f
d.v = c
d.x = g
i.u = d
i.v = e
i.s = e
assert h.v.u.y.txt == "f"