class A:
    def __init__(self, txt: str):
        self.x: F = None
        self.w: C = None
        self.s: C = 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.r: A = None
        self.w: F = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.o: C = None
        self.q: C = None
        self.z: G = None
        self.x: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

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

n.x = k
n.w = c
n.s = c
b.s = k
c.r = n
c.w = k
a.w = n
i.r = b
i.z = l
i.t = e
i.u = e
k.o = c
k.q = c
k.z = l
k.x = a
l.o = a
e.r = b
e.z = l
e.t = i
e.u = i
assert a.w.x.q.r.txt == "
class A:
    def __init__(self, txt: str):
        self.x: F = None
        self.w: C = None
        self.s: C = 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.r: A = None
        self.w: F = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.o: C = None
        self.q: C = None
        self.z: G = None
        self.x: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

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

n.x = k
n.w = c
n.s = c
b.s = k
c.r = n
c.w = k
a.w = n
i.r = b
i.z = l
i.t = e
i.u = e
k.o = c
k.q = c
k.z = l
k.x = a
l.o = a
e.r = b
e.z = l
e.t = i
e.u = i
assert a.w.x.q.r.txt == "n"