class A:
    def __init__(self, txt: str):
        self.s: E = None
        self.v: B = None
        self.q: C = None
        self.z: C = None
        self.t: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.v: E = None
        self.p: E = 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.s: C = None
        self.v: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.q: D = None
        self.txt = txt

g = A("g")
d = B("d")
e = C("e")
f = D("f")
a = E("a")

g.s = a
g.t = a
g.v = d
g.q = e
g.z = e
d.x = e
d.v = a
d.p = a
e.o = f
f.s = e
f.v = g
a.p = d
a.q = f
assert f.s.o.s.o.v.txt == "
class A:
    def __init__(self, txt: str):
        self.s: E = None
        self.v: B = None
        self.q: C = None
        self.z: C = None
        self.t: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.v: E = None
        self.p: E = 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.s: C = None
        self.v: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.q: D = None
        self.txt = txt

g = A("g")
d = B("d")
e = C("e")
f = D("f")
a = E("a")

g.s = a
g.t = a
g.v = d
g.q = e
g.z = e
d.x = e
d.v = a
d.p = a
e.o = f
f.s = e
f.v = g
a.p = d
a.q = f
assert f.s.o.s.o.v.txt == "g"