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

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

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

class D:
    def __init__(self, txt: str):
        self.z: C = None
        self.w: E = None
        self.v: E = None
        self.x: F = None
        self.r: H = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.u: A = None
        self.t: B = None
        self.q: E = None
        self.z: C = None
        self.s: D = None
        self.w: B = None
        self.txt = txt

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

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.z: C = None
        self.w: E = None
        self.v: E = None
        self.x: F = None
        self.r: H = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.u: A = None
        self.t: B = None
        self.q: E = None
        self.z: C = None
        self.s: D = None
        self.w: B = None
        self.txt = txt

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

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

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

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