class A:
    def __init__(self, txt: str):
        self.z: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.o: G = None
        self.v: G = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.v: C = None
        self.u: F = None
        self.s: B = None
        self.txt = txt

b = A("b")
d = B("d")
g = C("g")
l = D("l")
m = E("m")
e = F("e")
f = G("f")

b.z = e
d.t = b
d.y = e
d.x = f
d.s = f
d.w = l
g.o = l
l.p = g
l.o = f
l.v = f
m.o = f
m.w = b
e.p = l
f.v = g
f.u = e
f.s = d
assert f.s.y.p.v.s.txt == "
class A:
    def __init__(self, txt: str):
        self.z: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.o: G = None
        self.v: G = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.v: C = None
        self.u: F = None
        self.s: B = None
        self.txt = txt

b = A("b")
d = B("d")
g = C("g")
l = D("l")
m = E("m")
e = F("e")
f = G("f")

b.z = e
d.t = b
d.y = e
d.x = f
d.s = f
d.w = l
g.o = l
l.p = g
l.o = f
l.v = f
m.o = f
m.w = b
e.p = l
f.v = g
f.u = e
f.s = d
assert f.s.y.p.v.s.txt == "d"