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

class B:
    def __init__(self, txt: str):
        self.r: C = None
        self.x: C = None
        self.o: E = None
        self.p: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.y: E = None
        self.z: B = None
        self.q: F = None
        self.o: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: F = None
        self.txt = txt

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

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

f.s = k
a.r = n
a.x = n
a.o = e
a.p = e
n.s = k
n.w = a
n.q = a
k.y = e
k.z = a
k.o = a
k.q = b
e.w = b
b.o = k
b.x = a
b.v = n
assert b.x.o.w.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: C = None
        self.x: C = None
        self.o: E = None
        self.p: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.y: E = None
        self.z: B = None
        self.q: F = None
        self.o: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: F = None
        self.txt = txt

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

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

f.s = k
a.r = n
a.x = n
a.o = e
a.p = e
n.s = k
n.w = a
n.q = a
k.y = e
k.z = a
k.o = a
k.q = b
e.w = b
b.o = k
b.x = a
b.v = n
assert b.x.o.w.txt == "b"