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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.y: E = None
        self.s: G = None
        self.r: C = None
        self.o: C = None
        self.u: G = None
        self.q: A = None
        self.txt = txt

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

d = A("d")
g = B("g")
m = C("m")
c = D("c")
a = E("a")
k = F("k")
i = G("i")

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.y: E = None
        self.s: G = None
        self.r: C = None
        self.o: C = None
        self.u: G = None
        self.q: A = None
        self.txt = txt

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

d = A("d")
g = B("g")
m = C("m")
c = D("c")
a = E("a")
k = F("k")
i = G("i")

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