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

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

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

class D:
    def __init__(self, txt: str):
        self.q: D = None
        self.v: B = None
        self.txt = txt

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

i.w = h
h.r = m
h.p = d
h.o = g
l.z = d
l.s = d
l.w = k
l.r = j
j.q = m
j.v = h
c.q = k
c.v = h
d.w = h
m.q = f
m.v = h
k.q = m
k.v = h
g.z = i
g.s = d
g.w = m
g.r = m
f.q = j
f.v = h
assert c.q.v.r.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: D = None
        self.v: B = None
        self.txt = txt

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

i.w = h
h.r = m
h.p = d
h.o = g
l.z = d
l.s = d
l.w = k
l.r = j
j.q = m
j.v = h
c.q = k
c.v = h
d.w = h
m.q = f
m.v = h
k.q = m
k.v = h
g.z = i
g.s = d
g.w = m
g.r = m
f.q = j
f.v = h
assert c.q.v.r.q.q.txt == "j"