class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.x: F = None
        self.s: E = None
        self.r: F = None
        self.txt = txt

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.s: D = None
        self.u: B = None
        self.w: D = None
        self.y: F = None
        self.txt = txt

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

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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.s: D = None
        self.u: B = None
        self.w: D = None
        self.y: F = None
        self.txt = txt

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

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