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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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