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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.s: D = None
        self.q: A = None
        self.r: D = None
        self.p: G = None
        self.y: C = None
        self.v: E = None
        self.txt = txt

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

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

b.s = g
i.y = b
i.s = c
i.t = k
i.v = g
i.r = g
i.q = l
c.r = h
c.o = i
l.q = h
l.o = g
l.y = g
l.t = i
f.v = l
h.s = l
h.r = l
h.q = m
h.p = g
h.y = c
h.v = f
g.q = f
m.s = g
k.q = h
k.o = g
k.y = g
k.t = i
a.q = h
a.o = g
a.y = g
a.t = i
assert h.p.q.v.q.txt == "
class A:
    def __init__(self, txt: str):
        self.s: G = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.s: D = None
        self.q: A = None
        self.r: D = None
        self.p: G = None
        self.y: C = None
        self.v: E = None
        self.txt = txt

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

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

b.s = g
i.y = b
i.s = c
i.t = k
i.v = g
i.r = g
i.q = l
c.r = h
c.o = i
l.q = h
l.o = g
l.y = g
l.t = i
f.v = l
h.s = l
h.r = l
h.q = m
h.p = g
h.y = c
h.v = f
g.q = f
m.s = g
k.q = h
k.o = g
k.y = g
k.t = i
a.q = h
a.o = g
a.y = g
a.t = i
assert h.p.q.v.q.txt == "h"