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

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

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

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

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

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

n = A("n")
e = B("e")
d = C("d")
j = D("j")
l = E("l")
g = F("g")
b = A("b")
k = F("k")

n.w = k
n.r = e
n.q = g
e.u = l
d.x = j
j.p = b
l.s = e
g.s = k
g.x = l
g.u = b
g.y = n
b.w = k
b.q = k
b.r = e
k.s = g
k.x = l
k.u = b
k.y = b
assert k.u.q.x.s.u.s.txt == "
class A:
    def __init__(self, txt: str):
        self.w: F = None
        self.r: B = None
        self.q: F = None
        self.txt = txt

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

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

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

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

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

n = A("n")
e = B("e")
d = C("d")
j = D("j")
l = E("l")
g = F("g")
b = A("b")
k = F("k")

n.w = k
n.r = e
n.q = g
e.u = l
d.x = j
j.p = b
l.s = e
g.s = k
g.x = l
g.u = b
g.y = n
b.w = k
b.q = k
b.r = e
k.s = g
k.x = l
k.u = b
k.y = b
assert k.u.q.x.s.u.s.txt == "e"