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

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

class C:
    def __init__(self, txt: str):
        self.s: D = None
        self.u: E = None
        self.q: G = None
        self.p: B = None
        self.z: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.w: G = None
        self.o: B = None
        self.q: G = None
        self.s: B = None
        self.u: A = None
        self.t: G = None
        self.p: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.q: D = None
        self.x: D = None
        self.o: E = None
        self.t: E = None
        self.txt = txt

g = A("g")
l = B("l")
h = C("h")
d = D("d")
i = E("i")
a = F("a")
f = G("f")

g.u = l
l.q = i
l.w = g
l.u = a
l.y = d
l.x = f
h.s = d
h.z = d
h.u = i
h.q = f
h.p = l
d.u = h
d.s = g
i.w = f
i.q = f
i.t = f
i.o = l
i.s = l
i.p = l
i.u = g
a.s = f
a.o = l
f.q = d
f.x = d
f.o = i
f.t = i
assert g.u.x.o.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: D = None
        self.u: E = None
        self.q: G = None
        self.p: B = None
        self.z: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.w: G = None
        self.o: B = None
        self.q: G = None
        self.s: B = None
        self.u: A = None
        self.t: G = None
        self.p: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.q: D = None
        self.x: D = None
        self.o: E = None
        self.t: E = None
        self.txt = txt

g = A("g")
l = B("l")
h = C("h")
d = D("d")
i = E("i")
a = F("a")
f = G("f")

g.u = l
l.q = i
l.w = g
l.u = a
l.y = d
l.x = f
h.s = d
h.z = d
h.u = i
h.q = f
h.p = l
d.u = h
d.s = g
i.w = f
i.q = f
i.t = f
i.o = l
i.s = l
i.p = l
i.u = g
a.s = f
a.o = l
f.q = d
f.x = d
f.o = i
f.t = i
assert g.u.x.o.q.q.txt == "d"