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

class B:
    def __init__(self, txt: str):
        self.r: C = None
        self.o: E = None
        self.y: D = None
        self.t: E = None
        self.q: D = None
        self.v: A = None
        self.u: A = None
        self.txt = txt

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

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

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.r: C = None
        self.o: E = None
        self.y: D = None
        self.t: E = None
        self.q: D = None
        self.v: A = None
        self.u: A = None
        self.txt = txt

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

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

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

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

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

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

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