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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

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

g.t = n
l.v = f
l.s = n
f.v = l
f.p = h
n.x = l
h.s = k
h.q = k
h.z = g
h.y = e
k.z = l
e.y = h
e.x = g
assert g.t.x.v.v.s.x.s.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

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

g.t = n
l.v = f
l.s = n
f.v = l
f.p = h
n.x = l
h.s = k
h.q = k
h.z = g
h.y = e
k.z = l
e.y = h
e.x = g
assert g.t.x.v.v.s.x.s.txt == "n"