class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.x: C = None
        self.w: D = None
        self.t: B = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.x: C = None
        self.y: B = None
        self.txt = txt

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.x: C = None
        self.y: B = None
        self.txt = txt

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

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