class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.r: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: E = None
        self.w: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.r: F = None
        self.q: B = None
        self.w: A = None
        self.v: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: D = None
        self.z: D = None
        self.r: B = None
        self.u: E = None
        self.w: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: B = None
        self.r: C = None
        self.w: C = None
        self.u: B = None
        self.txt = txt

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

h.y = k
h.r = k
i.s = n
i.w = e
f.x = e
f.w = d
l.r = d
l.q = i
l.w = h
l.v = f
n.s = l
n.z = l
n.r = i
n.u = j
n.w = f
d.q = i
d.u = i
d.r = e
d.w = f
j.s = l
j.z = l
j.r = i
j.u = n
j.w = e
k.y = h
k.r = h
e.x = f
e.w = d
assert f.w.q.w.x.w.r.w.q.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.r: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: E = None
        self.w: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.r: F = None
        self.q: B = None
        self.w: A = None
        self.v: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: D = None
        self.z: D = None
        self.r: B = None
        self.u: E = None
        self.w: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: B = None
        self.r: C = None
        self.w: C = None
        self.u: B = None
        self.txt = txt

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

h.y = k
h.r = k
i.s = n
i.w = e
f.x = e
f.w = d
l.r = d
l.q = i
l.w = h
l.v = f
n.s = l
n.z = l
n.r = i
n.u = j
n.w = f
d.q = i
d.u = i
d.r = e
d.w = f
j.s = l
j.z = l
j.r = i
j.u = n
j.w = e
k.y = h
k.r = h
e.x = f
e.w = d
assert f.w.q.w.x.w.r.w.q.txt == "i"