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

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

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

class D:
    def __init__(self, txt: str):
        self.u: G = None
        self.v: G = None
        self.t: C = None
        self.s: G = None
        self.w: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.o: B = None
        self.r: G = None
        self.y: D = None
        self.u: E = None
        self.t: G = None
        self.q: B = None
        self.x: C = None
        self.txt = txt

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

a = A("a")
i = B("i")
f = C("f")
n = D("n")
h = E("h")
k = F("k")
g = G("g")
c = E("c")

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

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

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

class D:
    def __init__(self, txt: str):
        self.u: G = None
        self.v: G = None
        self.t: C = None
        self.s: G = None
        self.w: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.o: B = None
        self.r: G = None
        self.y: D = None
        self.u: E = None
        self.t: G = None
        self.q: B = None
        self.x: C = None
        self.txt = txt

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

a = A("a")
i = B("i")
f = C("f")
n = D("n")
h = E("h")
k = F("k")
g = G("g")
c = E("c")

a.x = f
a.r = g
i.v = f
i.y = f
i.w = h
f.r = i
n.u = g
n.v = g
n.s = g
n.t = f
n.w = a
h.o = n
k.o = i
k.q = i
k.r = g
k.t = g
k.y = n
k.u = c
k.x = f
g.q = c
c.o = n
assert k.u.o.v.q.o.w.x.r.txt == "i"