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

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.t: G = None
        self.w: C = None
        self.p: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: H = None
        self.s: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: A = None
        self.v: B = None
        self.s: D = None
        self.u: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: D = None
        self.r: G = None
        self.v: H = None
        self.u: B = None
        self.x: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: A = None
        self.t: B = None
        self.u: F = None
        self.z: F = None
        self.p: A = None
        self.txt = txt

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

l = A("l")
e = B("e")
m = C("m")
g = D("g")
k = E("k")
d = F("d")
i = G("i")
c = H("c")

l.s = g
e.u = g
e.p = g
e.t = i
e.w = m
m.y = e
g.r = c
g.s = d
k.x = l
k.v = e
k.s = g
k.u = g
d.w = g
d.r = i
d.v = c
d.u = e
d.x = e
i.r = l
i.p = l
i.t = e
i.u = d
i.z = d
c.o = g
assert l.s.r.o.r.o.s.w.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.t: G = None
        self.w: C = None
        self.p: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: H = None
        self.s: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: A = None
        self.v: B = None
        self.s: D = None
        self.u: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: D = None
        self.r: G = None
        self.v: H = None
        self.u: B = None
        self.x: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: A = None
        self.t: B = None
        self.u: F = None
        self.z: F = None
        self.p: A = None
        self.txt = txt

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

l = A("l")
e = B("e")
m = C("m")
g = D("g")
k = E("k")
d = F("d")
i = G("i")
c = H("c")

l.s = g
e.u = g
e.p = g
e.t = i
e.w = m
m.y = e
g.r = c
g.s = d
k.x = l
k.v = e
k.s = g
k.u = g
d.w = g
d.r = i
d.v = c
d.u = e
d.x = e
i.r = l
i.p = l
i.t = e
i.u = d
i.z = d
c.o = g
assert l.s.r.o.r.o.s.w.s.txt == "d"