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

class B:
    def __init__(self, txt: str):
        self.p: D = None
        self.o: B = None
        self.u: B = None
        self.txt = txt

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

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

h = A("h")
f = B("f")
l = C("l")
b = D("b")
i = A("i")
c = C("c")
j = A("j")
m = D("m")
n = B("n")
k = C("k")

h.w = j
f.p = m
f.o = n
f.u = n
l.w = c
l.x = c
l.q = h
l.s = b
b.r = m
b.w = m
i.w = j
c.w = l
c.x = k
c.q = j
c.s = m
j.w = i
m.r = b
m.w = b
n.p = m
n.o = f
n.u = f
k.w = l
k.x = l
k.q = i
k.s = m
assert i.w.w.w.w.w.w.w.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: D = None
        self.o: B = None
        self.u: B = None
        self.txt = txt

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

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

h = A("h")
f = B("f")
l = C("l")
b = D("b")
i = A("i")
c = C("c")
j = A("j")
m = D("m")
n = B("n")
k = C("k")

h.w = j
f.p = m
f.o = n
f.u = n
l.w = c
l.x = c
l.q = h
l.s = b
b.r = m
b.w = m
i.w = j
c.w = l
c.x = k
c.q = j
c.s = m
j.w = i
m.r = b
m.w = b
n.p = m
n.o = f
n.u = f
k.w = l
k.x = l
k.q = i
k.s = m
assert i.w.w.w.w.w.w.w.w.w.w.txt == "i"