class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.z: F = None
        self.y: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.q: B = None
        self.y: E = None
        self.x: F = None
        self.p: F = None
        self.w: E = None
        self.u: F = None
        self.z: C = None
        self.r: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.w: A = None
        self.x: H = None
        self.p: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.z: A = None
        self.r: A = None
        self.v: E = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.q: B = None
        self.y: E = None
        self.x: F = None
        self.p: F = None
        self.w: E = None
        self.u: F = None
        self.z: C = None
        self.r: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.w: A = None
        self.x: H = None
        self.p: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.z: A = None
        self.r: A = None
        self.v: E = None
        self.txt = txt

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

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

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