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

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: B = None
        self.z: C = None
        self.u: D = None
        self.v: D = None
        self.o: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: A = None
        self.v: A = None
        self.r: F = None
        self.txt = txt

d = A("d")
k = B("k")
i = C("i")
l = D("l")
h = E("h")
g = F("g")
n = F("n")
m = A("m")
a = B("a")
e = E("e")

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: B = None
        self.z: C = None
        self.u: D = None
        self.v: D = None
        self.o: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: A = None
        self.v: A = None
        self.r: F = None
        self.txt = txt

d = A("d")
k = B("k")
i = C("i")
l = D("l")
h = E("h")
g = F("g")
n = F("n")
m = A("m")
a = B("a")
e = E("e")

d.r = l
d.w = l
d.s = n
d.p = m
k.q = m
k.y = a
k.w = a
k.x = l
i.o = l
i.s = g
i.q = g
l.z = e
h.y = k
h.o = k
h.z = i
h.u = l
h.v = l
g.o = d
g.v = m
g.r = n
n.o = m
n.v = m
n.r = g
m.r = l
m.w = l
m.s = n
m.p = d
a.q = m
a.y = k
a.w = k
a.x = l
e.y = k
e.o = k
e.z = i
e.u = l
e.v = l
assert m.s.r.v.txt == "m"