class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.w: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: A = None
        self.u: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: F = None
        self.t: A = None
        self.z: G = None
        self.x: F = None
        self.p: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.w: C = None
        self.z: F = None
        self.txt = txt

l = A("l")
d = B("d")
g = C("g")
a = D("a")
f = E("f")
e = F("e")
k = G("k")
n = F("n")
m = B("m")

l.r = f
l.w = n
d.s = n
g.u = a
a.w = l
a.u = n
f.u = e
f.t = l
f.p = l
f.z = k
f.x = n
e.t = k
k.w = g
k.z = n
n.t = k
m.s = n
assert k.z.t.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.w: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: A = None
        self.u: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: F = None
        self.t: A = None
        self.z: G = None
        self.x: F = None
        self.p: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.w: C = None
        self.z: F = None
        self.txt = txt

l = A("l")
d = B("d")
g = C("g")
a = D("a")
f = E("f")
e = F("e")
k = G("k")
n = F("n")
m = B("m")

l.r = f
l.w = n
d.s = n
g.u = a
a.w = l
a.u = n
f.u = e
f.t = l
f.p = l
f.z = k
f.x = n
e.t = k
k.w = g
k.z = n
n.t = k
m.s = n
assert k.z.t.z.txt == "n"