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

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

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.o: C = None
        self.t: A = None
        self.z: E = None
        self.v: C = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.o: C = None
        self.t: A = None
        self.z: E = None
        self.v: C = None
        self.txt = txt

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

b.s = n
b.x = n
b.w = g
b.q = m
b.y = e
g.v = m
g.q = m
m.z = d
e.s = m
d.r = n
d.x = g
n.o = m
n.v = m
n.t = b
n.z = d
assert e.s.z.r.z.txt == "d"