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

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

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

class D:
    def __init__(self, txt: str):
        self.q: E = None
        self.r: D = None
        self.s: B = None
        self.w: A = None
        self.o: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: B = None
        self.s: C = None
        self.txt = txt

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

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

h.u = e
h.s = g
e.z = c
e.x = h
e.y = g
b.s = e
a.q = f
a.o = f
a.r = g
a.s = e
a.w = h
f.y = e
f.s = b
c.v = f
c.z = b
g.q = f
g.o = f
g.r = a
g.s = e
g.w = h
assert a.w.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.s: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: E = None
        self.r: D = None
        self.s: B = None
        self.w: A = None
        self.o: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: B = None
        self.s: C = None
        self.txt = txt

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

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

h.u = e
h.s = g
e.z = c
e.x = h
e.y = g
b.s = e
a.q = f
a.o = f
a.r = g
a.s = e
a.w = h
f.y = e
f.s = b
c.v = f
c.z = b
g.q = f
g.o = f
g.r = a
g.s = e
g.w = h
assert a.w.s.s.txt == "e"