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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.o: E = None
        self.v: B = None
        self.t: A = None
        self.x: A = None
        self.r: D = None
        self.txt = txt

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

a.s = h
a.q = h
b.w = g
b.t = a
d.w = h
d.y = h
d.r = a
d.q = f
g.p = e
g.s = e
g.o = f
g.y = n
g.u = h
e.r = f
e.y = m
f.o = e
f.v = m
f.t = a
f.x = a
f.r = n
h.w = d
h.y = d
h.r = a
h.q = f
n.p = e
n.s = e
n.o = f
n.y = g
n.u = d
m.w = n
m.t = a
assert e.y.t.s.q.r.o.x.q.w.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.q: C = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.o: E = None
        self.v: B = None
        self.t: A = None
        self.x: A = None
        self.r: D = None
        self.txt = txt

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

a.s = h
a.q = h
b.w = g
b.t = a
d.w = h
d.y = h
d.r = a
d.q = f
g.p = e
g.s = e
g.o = f
g.y = n
g.u = h
e.r = f
e.y = m
f.o = e
f.v = m
f.t = a
f.x = a
f.r = n
h.w = d
h.y = d
h.r = a
h.q = f
n.p = e
n.s = e
n.o = f
n.y = g
n.u = d
m.w = n
m.t = a
assert e.y.t.s.q.r.o.x.q.w.txt == "d"