class A:
    def __init__(self, txt: str):
        self.s: G = None
        self.x: D = None
        self.y: D = None
        self.p: D = None
        self.w: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.w: E = None
        self.q: C = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.s: F = None
        self.x: E = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.w: E = None
        self.q: C = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.s: F = None
        self.x: E = None
        self.txt = txt

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

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