class A:
    def __init__(self, txt: str):
        self.u: G = None
        self.v: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: E = None
        self.z: E = None
        self.s: D = None
        self.v: E = None
        self.t: F = None
        self.r: G = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.p: F = None
        self.s: H = None
        self.t: D = None
        self.z: C = None
        self.o: D = None
        self.r: B = None
        self.v: A = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.u: E = None
        self.z: E = None
        self.s: D = None
        self.v: E = None
        self.t: F = None
        self.r: G = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.p: F = None
        self.s: H = None
        self.t: D = None
        self.z: C = None
        self.o: D = None
        self.r: B = None
        self.v: A = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

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