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

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

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

class D:
    def __init__(self, txt: str):
        self.v: G = None
        self.x: G = None
        self.y: B = None
        self.o: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

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

h.o = g
h.x = n
j.p = f
j.w = i
j.r = l
e.s = c
g.v = f
g.x = f
g.y = i
g.o = n
l.x = h
l.p = g
l.r = e
c.o = n
f.w = j
f.u = n
f.x = d
d.v = f
d.x = f
d.y = j
d.o = e
i.p = f
i.w = j
i.r = l
n.s = c
assert i.w.w.r.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.x: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.v: G = None
        self.x: G = None
        self.y: B = None
        self.o: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

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

h.o = g
h.x = n
j.p = f
j.w = i
j.r = l
e.s = c
g.v = f
g.x = f
g.y = i
g.o = n
l.x = h
l.p = g
l.r = e
c.o = n
f.w = j
f.u = n
f.x = d
d.v = f
d.x = f
d.y = j
d.o = e
i.p = f
i.w = j
i.r = l
n.s = c
assert i.w.w.r.txt == "l"