class A:
    def __init__(self, txt: str):
        self.w: F = None
        self.s: F = None
        self.t: G = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.u: C = None
        self.x: G = None
        self.y: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.t: B = None
        self.o: D = None
        self.z: A = None
        self.w: C = None
        self.r: F = None
        self.y: B = None
        self.txt = txt

k = A("k")
f = B("f")
b = C("b")
n = D("n")
i = E("i")
a = F("a")
c = G("c")
d = G("d")

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.u: C = None
        self.x: G = None
        self.y: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.t: B = None
        self.o: D = None
        self.z: A = None
        self.w: C = None
        self.r: F = None
        self.y: B = None
        self.txt = txt

k = A("k")
f = B("f")
b = C("b")
n = D("n")
i = E("i")
a = F("a")
c = G("c")
d = G("d")

k.w = a
k.s = a
k.t = d
f.o = d
f.w = d
f.r = a
b.q = i
b.t = a
b.y = a
b.p = n
b.s = n
b.z = c
b.r = f
n.v = a
n.r = a
i.t = k
i.y = k
i.u = b
i.x = d
a.z = f
a.r = d
a.q = k
a.t = n
a.p = b
c.t = f
c.y = f
c.o = n
c.z = k
c.w = b
c.r = a
d.t = f
d.y = f
d.o = n
d.z = k
d.w = b
d.r = a
assert i.u.r.w.z.w.p.r.txt == "f"