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

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

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

class D:
    def __init__(self, txt: str):
        self.u: E = None
        self.p: G = None
        self.o: H = None
        self.w: B = None
        self.s: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: D = None
        self.v: A = None
        self.q: C = None
        self.o: F = None
        self.t: B = None
        self.p: H = None
        self.w: H = None
        self.txt = txt

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

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

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

g = A("g")
j = B("j")
b = C("b")
c = D("c")
m = E("m")
h = F("h")
n = G("n")
f = H("f")

g.u = f
g.s = m
g.y = c
g.q = b
j.x = h
j.q = b
j.s = c
j.z = n
b.s = h
c.u = m
c.s = m
c.p = n
c.o = f
c.w = j
m.x = c
m.v = g
m.q = b
m.o = h
m.t = j
m.p = f
m.w = f
h.t = m
h.r = f
h.q = f
h.p = g
h.o = n
n.u = m
f.z = g
assert j.q.s.p.q.s.r.txt == "
class A:
    def __init__(self, txt: str):
        self.u: H = None
        self.s: E = None
        self.y: D = None
        self.q: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: E = None
        self.p: G = None
        self.o: H = None
        self.w: B = None
        self.s: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: D = None
        self.v: A = None
        self.q: C = None
        self.o: F = None
        self.t: B = None
        self.p: H = None
        self.w: H = None
        self.txt = txt

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

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

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

g = A("g")
j = B("j")
b = C("b")
c = D("c")
m = E("m")
h = F("h")
n = G("n")
f = H("f")

g.u = f
g.s = m
g.y = c
g.q = b
j.x = h
j.q = b
j.s = c
j.z = n
b.s = h
c.u = m
c.s = m
c.p = n
c.o = f
c.w = j
m.x = c
m.v = g
m.q = b
m.o = h
m.t = j
m.p = f
m.w = f
h.t = m
h.r = f
h.q = f
h.p = g
h.o = n
n.u = m
f.z = g
assert j.q.s.p.q.s.r.txt == "f"