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

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

class C:
    def __init__(self, txt: str):
        self.v: H = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: A = None
        self.w: E = None
        self.t: G = None
        self.q: F = None
        self.x: H = None
        self.s: E = None
        self.txt = txt

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

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

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.v: H = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: A = None
        self.w: E = None
        self.t: G = None
        self.q: F = None
        self.x: H = None
        self.s: E = None
        self.txt = txt

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

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

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

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

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

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