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

class B:
    def __init__(self, txt: str):
        self.u: F = None
        self.o: F = None
        self.s: E = None
        self.z: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: E = None
        self.o: E = None
        self.t: C = None
        self.y: F = None
        self.r: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: F = None
        self.txt = txt

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

e = A("e")
d = B("d")
c = C("c")
h = D("h")
k = E("k")
g = F("g")

e.y = h
e.x = h
e.z = d
e.r = d
e.q = c
d.u = g
d.o = g
d.s = k
d.z = h
c.o = k
c.s = k
c.x = d
c.w = h
c.y = h
h.u = k
h.o = k
h.t = c
h.y = g
h.r = e
k.o = g
g.z = d
assert k.o.z.u.z.s.o.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.z: B = None
        self.q: C = None
        self.r: B = None
        self.x: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: F = None
        self.o: F = None
        self.s: E = None
        self.z: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: E = None
        self.o: E = None
        self.t: C = None
        self.y: F = None
        self.r: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: F = None
        self.txt = txt

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

e = A("e")
d = B("d")
c = C("c")
h = D("h")
k = E("k")
g = F("g")

e.y = h
e.x = h
e.z = d
e.r = d
e.q = c
d.u = g
d.o = g
d.s = k
d.z = h
c.o = k
c.s = k
c.x = d
c.w = h
c.y = h
h.u = k
h.o = k
h.t = c
h.y = g
h.r = e
k.o = g
g.z = d
assert k.o.z.u.z.s.o.txt == "g"