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

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

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

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

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

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

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

g = A("g")
i = B("i")
d = C("d")
k = D("k")
n = E("n")
e = F("e")
f = G("f")
a = G("a")
m = B("m")

g.s = m
i.r = m
i.y = d
d.t = n
d.q = f
k.w = n
k.t = n
k.p = a
n.x = k
e.s = f
e.t = k
e.y = d
f.s = m
f.x = k
f.r = n
a.s = i
a.x = k
a.r = n
m.r = i
m.y = d
assert i.y.q.x.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

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

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

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

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

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

g = A("g")
i = B("i")
d = C("d")
k = D("k")
n = E("n")
e = F("e")
f = G("f")
a = G("a")
m = B("m")

g.s = m
i.r = m
i.y = d
d.t = n
d.q = f
k.w = n
k.t = n
k.p = a
n.x = k
e.s = f
e.t = k
e.y = d
f.s = m
f.x = k
f.r = n
a.s = i
a.x = k
a.r = n
m.r = i
m.y = d
assert i.y.q.x.txt == "k"