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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.u: C = None
        self.v: D = None
        self.r: F = None
        self.p: B = None
        self.y: E = None
        self.txt = txt

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

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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.u: C = None
        self.v: D = None
        self.r: F = None
        self.p: B = None
        self.y: E = None
        self.txt = txt

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

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