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

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

class C:
    def __init__(self, txt: str):
        self.z: B = None
        self.u: A = None
        self.x: E = None
        self.q: B = None
        self.t: A = None
        self.w: G = None
        self.v: D = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.z: A = None
        self.o: E = None
        self.u: B = None
        self.q: C = None
        self.txt = txt

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

d.w = n
g.z = h
g.w = n
g.x = l
i.z = g
i.q = g
i.u = d
i.t = d
i.x = b
i.w = n
i.v = h
h.s = i
l.r = b
l.s = b
a.v = l
a.o = i
a.s = g
n.z = d
n.o = l
n.u = g
n.q = i
b.r = l
b.s = l
assert b.s.s.s.s.r.r.s.r.txt == "
class A:
    def __init__(self, txt: str):
        self.w: G = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: B = None
        self.u: A = None
        self.x: E = None
        self.q: B = None
        self.t: A = None
        self.w: G = None
        self.v: D = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.z: A = None
        self.o: E = None
        self.u: B = None
        self.q: C = None
        self.txt = txt

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

d.w = n
g.z = h
g.w = n
g.x = l
i.z = g
i.q = g
i.u = d
i.t = d
i.x = b
i.w = n
i.v = h
h.s = i
l.r = b
l.s = b
a.v = l
a.o = i
a.s = g
n.z = d
n.o = l
n.u = g
n.q = i
b.r = l
b.s = l
assert b.s.s.s.s.r.r.s.r.txt == "b"