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

class B:
    def __init__(self, txt: str):
        self.x: G = None
        self.r: E = None
        self.q: C = None
        self.t: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: F = None
        self.u: C = None
        self.x: B = None
        self.s: B = None
        self.o: D = None
        self.t: D = None
        self.q: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.t: G = None
        self.txt = txt

b = A("b")
g = B("g")
e = C("e")
j = D("j")
l = E("l")
f = F("f")
d = G("d")
h = C("h")
c = C("c")
m = G("m")

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

class B:
    def __init__(self, txt: str):
        self.x: G = None
        self.r: E = None
        self.q: C = None
        self.t: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: F = None
        self.u: C = None
        self.x: B = None
        self.s: B = None
        self.o: D = None
        self.t: D = None
        self.q: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.t: G = None
        self.txt = txt

b = A("b")
g = B("g")
e = C("e")
j = D("j")
l = E("l")
f = F("f")
d = G("d")
h = C("h")
c = C("c")
m = G("m")

b.r = h
b.w = h
b.x = e
g.x = m
g.r = l
g.q = c
g.t = f
e.r = f
e.u = h
e.x = g
e.s = g
e.q = g
e.o = j
e.t = j
j.o = b
l.q = f
l.r = f
l.z = j
f.p = l
f.s = l
f.q = l
f.x = b
f.t = g
f.w = m
d.t = m
h.r = f
h.u = c
h.x = g
h.s = g
h.q = g
h.o = j
h.t = j
c.r = f
c.u = h
c.x = g
c.s = g
c.q = g
c.o = j
c.t = j
m.t = d
assert f.t.q.q.q.r.x.r.t.o.txt == "b"