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

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

class C:
    def __init__(self, txt: str):
        self.y: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.u: E = None
        self.o: A = None
        self.x: C = None
        self.txt = txt

a = A("a")
f = B("f")
h = C("h")
c = D("c")
k = E("k")
b = B("b")
g = E("g")

a.x = c
a.s = h
a.w = h
a.t = h
a.q = g
f.w = g
f.z = a
h.y = a
c.z = g
c.q = b
c.x = k
k.p = b
k.u = g
k.o = a
k.x = h
b.w = g
b.z = a
g.p = f
g.u = k
g.o = a
g.x = h
assert f.w.u.x.y.s.y.q.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.s: C = None
        self.w: C = None
        self.t: C = None
        self.q: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.u: E = None
        self.o: A = None
        self.x: C = None
        self.txt = txt

a = A("a")
f = B("f")
h = C("h")
c = D("c")
k = E("k")
b = B("b")
g = E("g")

a.x = c
a.s = h
a.w = h
a.t = h
a.q = g
f.w = g
f.z = a
h.y = a
c.z = g
c.q = b
c.x = k
k.p = b
k.u = g
k.o = a
k.x = h
b.w = g
b.z = a
g.p = f
g.u = k
g.o = a
g.x = h
assert f.w.u.x.y.s.y.q.txt == "g"