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

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

class C:
    def __init__(self, txt: str):
        self.s: E = None
        self.t: D = None
        self.z: F = None
        self.y: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: A = None
        self.r: E = None
        self.o: G = None
        self.p: E = None
        self.x: F = None
        self.z: D = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: G = None
        self.p: A = None
        self.w: D = None
        self.v: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.z: C = None
        self.q: B = None
        self.r: D = None
        self.o: A = None
        self.p: F = None
        self.s: F = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.s: E = None
        self.t: D = None
        self.z: F = None
        self.y: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: A = None
        self.r: E = None
        self.o: G = None
        self.p: E = None
        self.x: F = None
        self.z: D = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: G = None
        self.p: A = None
        self.w: D = None
        self.v: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.z: C = None
        self.q: B = None
        self.r: D = None
        self.o: A = None
        self.p: F = None
        self.s: F = None
        self.txt = txt

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

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