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

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

class C:
    def __init__(self, txt: str):
        self.t: G = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

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

a.q = l
a.s = g
l.r = c
l.y = a
l.t = a
l.w = a
g.t = h
c.q = h
k.w = g
k.v = g
k.y = a
k.r = l
k.x = j
j.v = l
h.s = g
i.q = l
i.s = g
b.w = g
b.v = g
b.y = a
b.r = l
b.x = j
assert a.s.t.s.t.s.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.s: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: G = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

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

a.q = l
a.s = g
l.r = c
l.y = a
l.t = a
l.w = a
g.t = h
c.q = h
k.w = g
k.v = g
k.y = a
k.r = l
k.x = j
j.v = l
h.s = g
i.q = l
i.s = g
b.w = g
b.v = g
b.y = a
b.r = l
b.x = j
assert a.s.t.s.t.s.txt == "g"