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

class B:
    def __init__(self, txt: str):
        self.w: F = None
        self.s: E = None
        self.v: E = None
        self.u: A = None
        self.p: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.x: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: A = None
        self.u: E = None
        self.q: C = None
        self.r: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: C = None
        self.t: G = None
        self.r: G = None
        self.u: B = None
        self.txt = txt

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.w: F = None
        self.s: E = None
        self.v: E = None
        self.u: A = None
        self.p: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.x: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: A = None
        self.u: E = None
        self.q: C = None
        self.r: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: C = None
        self.t: G = None
        self.r: G = None
        self.u: B = None
        self.txt = txt

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

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

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

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