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

class B:
    def __init__(self, txt: str):
        self.w: C = None
        self.v: E = None
        self.y: F = None
        self.o: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.w: E = None
        self.v: B = None
        self.x: F = None
        self.p: F = None
        self.txt = txt

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

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

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

g = A("g")
f = B("f")
k = C("k")
c = D("c")
m = E("m")
j = F("j")
e = F("e")

g.z = f
g.q = f
g.y = e
g.s = c
f.w = k
f.v = m
f.y = j
f.o = e
k.r = c
k.w = m
k.v = f
k.x = j
k.p = j
c.w = m
m.w = g
j.r = k
e.r = k
assert g.s.w.w.s.w.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.y: F = None
        self.s: D = None
        self.q: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: C = None
        self.v: E = None
        self.y: F = None
        self.o: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.w: E = None
        self.v: B = None
        self.x: F = None
        self.p: F = None
        self.txt = txt

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

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

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

g = A("g")
f = B("f")
k = C("k")
c = D("c")
m = E("m")
j = F("j")
e = F("e")

g.z = f
g.q = f
g.y = e
g.s = c
f.w = k
f.v = m
f.y = j
f.o = e
k.r = c
k.w = m
k.v = f
k.x = j
k.p = j
c.w = m
m.w = g
j.r = k
e.r = k
assert g.s.w.w.s.w.txt == "m"