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

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.p: D = None
        self.o: C = None
        self.q: F = None
        self.z: G = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.o: E = None
        self.p: E = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.p: D = None
        self.o: C = None
        self.q: F = None
        self.z: G = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.o: E = None
        self.p: E = None
        self.txt = txt

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

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

l.y = n
i.t = m
i.p = n
i.o = h
i.q = g
i.z = f
h.w = g
h.s = g
h.o = m
n.r = f
m.q = b
g.o = m
g.p = m
f.t = i
f.z = n
f.s = n
f.x = l
f.y = h
e.t = i
e.z = n
e.s = n
e.x = l
e.y = h
b.w = g
b.s = g
b.o = m
assert n.r.t.o.s.p.q.o.txt == "m"