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

class B:
    def __init__(self, txt: str):
        self.p: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: B = None
        self.y: E = None
        self.q: H = None
        self.p: H = None
        self.t: D = None
        self.s: A = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.u: H = None
        self.p: G = None
        self.o: E = None
        self.q: G = None
        self.s: C = None
        self.y: C = None
        self.r: B = None
        self.txt = txt

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

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

j = A("j")
l = B("l")
m = C("m")
b = D("b")
f = E("f")
d = F("d")
h = G("h")
a = H("a")

j.x = h
j.q = h
l.p = h
m.z = l
m.y = f
m.q = a
m.p = a
m.t = b
m.s = j
b.t = j
b.u = j
b.y = j
b.v = j
b.o = h
b.s = f
b.r = l
f.o = l
f.q = d
d.u = a
d.p = h
d.q = h
d.o = f
d.s = m
d.y = m
d.r = l
h.y = l
h.x = b
a.y = b
assert l.p.x.r.p.txt == "
class A:
    def __init__(self, txt: str):
        self.x: G = None
        self.q: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: B = None
        self.y: E = None
        self.q: H = None
        self.p: H = None
        self.t: D = None
        self.s: A = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.u: H = None
        self.p: G = None
        self.o: E = None
        self.q: G = None
        self.s: C = None
        self.y: C = None
        self.r: B = None
        self.txt = txt

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

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

j = A("j")
l = B("l")
m = C("m")
b = D("b")
f = E("f")
d = F("d")
h = G("h")
a = H("a")

j.x = h
j.q = h
l.p = h
m.z = l
m.y = f
m.q = a
m.p = a
m.t = b
m.s = j
b.t = j
b.u = j
b.y = j
b.v = j
b.o = h
b.s = f
b.r = l
f.o = l
f.q = d
d.u = a
d.p = h
d.q = h
d.o = f
d.s = m
d.y = m
d.r = l
h.y = l
h.x = b
a.y = b
assert l.p.x.r.p.txt == "h"