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

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

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

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

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

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

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

d.w = j
d.s = g
k.p = l
k.v = l
k.r = f
k.q = d
j.o = l
i.x = l
i.z = j
f.z = i
l.q = d
l.x = k
g.x = l
g.z = j
b.w = j
b.s = g
assert i.z.o.x.q.s.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.s: D = None
        self.txt = txt

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

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

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

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

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

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

d.w = j
d.s = g
k.p = l
k.v = l
k.r = f
k.q = d
j.o = l
i.x = l
i.z = j
f.z = i
l.q = d
l.x = k
g.x = l
g.z = j
b.w = j
b.s = g
assert i.z.o.x.q.s.txt == "g"