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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.r: A = None
        self.q: D = None
        self.o: B = None
        self.p: E = None
        self.txt = txt

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

h = A("h")
c = B("c")
n = C("n")
l = D("l")
a = E("a")
k = F("k")
f = G("f")
d = E("d")
e = D("e")

h.o = l
h.q = k
c.v = d
c.r = d
c.y = e
c.s = l
c.w = l
n.y = c
n.r = k
l.z = e
a.r = e
a.p = c
k.r = h
k.q = l
k.o = c
k.p = d
f.r = l
f.u = d
d.r = l
d.p = c
e.z = l
assert h.q.q.z.z.z.z.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.q: F = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.r: A = None
        self.q: D = None
        self.o: B = None
        self.p: E = None
        self.txt = txt

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

h = A("h")
c = B("c")
n = C("n")
l = D("l")
a = E("a")
k = F("k")
f = G("f")
d = E("d")
e = D("e")

h.o = l
h.q = k
c.v = d
c.r = d
c.y = e
c.s = l
c.w = l
n.y = c
n.r = k
l.z = e
a.r = e
a.p = c
k.r = h
k.q = l
k.o = c
k.p = d
f.r = l
f.u = d
d.r = l
d.p = c
e.z = l
assert h.q.q.z.z.z.z.z.z.z.txt == "e"