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

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

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

class D:
    def __init__(self, txt: str):
        self.v: A = None
        self.y: G = None
        self.s: G = None
        self.x: A = None
        self.q: C = None
        self.z: C = None
        self.txt = txt

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

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

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

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

l.s = k
l.q = h
m.p = l
g.s = i
n.v = l
n.x = l
n.y = i
n.s = i
n.q = g
n.z = g
h.v = l
k.r = g
k.y = l
i.t = k
a.v = l
a.x = l
a.y = i
a.s = i
a.q = g
a.z = g
assert a.y.t.y.s.r.txt == "
class A:
    def __init__(self, txt: str):
        self.s: F = None
        self.q: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.v: A = None
        self.y: G = None
        self.s: G = None
        self.x: A = None
        self.q: C = None
        self.z: C = None
        self.txt = txt

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

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

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

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

l.s = k
l.q = h
m.p = l
g.s = i
n.v = l
n.x = l
n.y = i
n.s = i
n.q = g
n.z = g
h.v = l
k.r = g
k.y = l
i.t = k
a.v = l
a.x = l
a.y = i
a.s = i
a.q = g
a.z = g
assert a.y.t.y.s.r.txt == "g"