class A:
    def __init__(self, txt: str):
        self.y: F = None
        self.u: B = None
        self.s: G = None
        self.r: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.p: G = None
        self.s: H = None
        self.q: D = None
        self.x: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: C = None
        self.y: C = None
        self.o: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

m = A("m")
b = B("b")
f = C("f")
g = D("g")
i = E("i")
l = F("l")
e = G("e")
n = H("n")
k = H("k")

m.y = l
m.u = b
m.r = b
m.s = e
b.r = g
f.w = m
f.y = g
f.s = i
f.t = b
f.u = b
f.x = l
f.r = l
g.x = b
g.o = l
g.w = m
i.p = b
i.z = b
l.p = e
l.s = n
l.q = g
l.x = m
e.u = f
e.y = f
e.o = i
n.z = i
k.z = i
assert g.w.r.r.w.y.p.u.u.r.txt == "
class A:
    def __init__(self, txt: str):
        self.y: F = None
        self.u: B = None
        self.s: G = None
        self.r: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.p: G = None
        self.s: H = None
        self.q: D = None
        self.x: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: C = None
        self.y: C = None
        self.o: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

m = A("m")
b = B("b")
f = C("f")
g = D("g")
i = E("i")
l = F("l")
e = G("e")
n = H("n")
k = H("k")

m.y = l
m.u = b
m.r = b
m.s = e
b.r = g
f.w = m
f.y = g
f.s = i
f.t = b
f.u = b
f.x = l
f.r = l
g.x = b
g.o = l
g.w = m
i.p = b
i.z = b
l.p = e
l.s = n
l.q = g
l.x = m
e.u = f
e.y = f
e.o = i
n.z = i
k.z = i
assert g.w.r.r.w.y.p.u.u.r.txt == "g"