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

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.t: F = None
        self.o: G = None
        self.z: C = None
        self.u: D = None
        self.x: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: G = None
        self.o: A = None
        self.x: E = None
        self.v: B = None
        self.y: F = None
        self.w: E = None
        self.t: A = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.o: E = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.t: F = None
        self.o: G = None
        self.z: C = None
        self.u: D = None
        self.x: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: G = None
        self.o: A = None
        self.x: E = None
        self.v: B = None
        self.y: F = None
        self.w: E = None
        self.t: A = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.o: E = None
        self.txt = txt

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

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